Code style fixes

This commit is contained in:
Dmitry Khomutov 2016-04-21 10:58:09 +06:00
parent 0868eb9c69
commit 6891b8a75f
87 changed files with 598 additions and 603 deletions

View file

@ -28,21 +28,21 @@ $primaryKey = 'id';
// The `db` parameter represents the column name in the database, while the `dt`
// parameter represents the DataTables column identifier. In this case simple
// indexes
$columns = array(
array( 'db' => 'id', 'dt' => 0 ),
array( 'db' => 'firstname', 'dt' => 1 ),
array( 'db' => 'surname', 'dt' => 2 ),
array( 'db' => 'zip', 'dt' => 3 ),
array( 'db' => 'country', 'dt' => 4 )
);
$columns = [
['db' => 'id', 'dt' => 0],
['db' => 'firstname', 'dt' => 1],
['db' => 'surname', 'dt' => 2],
['db' => 'zip', 'dt' => 3],
['db' => 'country', 'dt' => 4]
];
// SQL server connection information
$sql_details = array(
'user' => '',
'pass' => '',
'db' => '',
'host' => ''
);
$sql_details = [
'user' => '',
'pass' => '',
'db' => '',
'host' => ''
];
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@ -50,9 +50,9 @@ $sql_details = array(
* server-side, there is no need to edit below this line.
*/
require( '../../../../examples/server_side/scripts/ssp.class.php' );
require('../../../../examples/server_side/scripts/ssp.class.php');
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns)
);

View file

@ -17,7 +17,7 @@ class BuildBase extends Model
/**
* @var array
*/
public static $sleepable = array();
public static $sleepable = [];
/**
* @var string
@ -32,155 +32,155 @@ class BuildBase extends Model
/**
* @var array
*/
protected $data = array(
'id' => null,
'project_id' => null,
'commit_id' => null,
'status' => null,
'log' => null,
'branch' => null,
'created' => null,
'started' => null,
'finished' => null,
protected $data = [
'id' => null,
'project_id' => null,
'commit_id' => null,
'status' => null,
'log' => null,
'branch' => null,
'created' => null,
'started' => null,
'finished' => null,
'committer_email' => null,
'commit_message' => null,
'extra' => null,
);
'commit_message' => null,
'extra' => null,
];
/**
* @var array
*/
protected $getters = array(
protected $getters = [
// Direct property getters:
'id' => 'getId',
'project_id' => 'getProjectId',
'commit_id' => 'getCommitId',
'status' => 'getStatus',
'log' => 'getLog',
'branch' => 'getBranch',
'created' => 'getCreated',
'started' => 'getStarted',
'finished' => 'getFinished',
'id' => 'getId',
'project_id' => 'getProjectId',
'commit_id' => 'getCommitId',
'status' => 'getStatus',
'log' => 'getLog',
'branch' => 'getBranch',
'created' => 'getCreated',
'started' => 'getStarted',
'finished' => 'getFinished',
'committer_email' => 'getCommitterEmail',
'commit_message' => 'getCommitMessage',
'extra' => 'getExtra',
'commit_message' => 'getCommitMessage',
'extra' => 'getExtra',
// Foreign key getters:
'Project' => 'getProject',
);
];
/**
* @var array
*/
protected $setters = array(
protected $setters = [
// Direct property setters:
'id' => 'setId',
'project_id' => 'setProjectId',
'commit_id' => 'setCommitId',
'status' => 'setStatus',
'log' => 'setLog',
'branch' => 'setBranch',
'created' => 'setCreated',
'started' => 'setStarted',
'finished' => 'setFinished',
'id' => 'setId',
'project_id' => 'setProjectId',
'commit_id' => 'setCommitId',
'status' => 'setStatus',
'log' => 'setLog',
'branch' => 'setBranch',
'created' => 'setCreated',
'started' => 'setStarted',
'finished' => 'setFinished',
'committer_email' => 'setCommitterEmail',
'commit_message' => 'setCommitMessage',
'extra' => 'setExtra',
'commit_message' => 'setCommitMessage',
'extra' => 'setExtra',
// Foreign key setters:
'Project' => 'setProject',
);
];
/**
* @var array
*/
public $columns = array(
'id' => array(
'type' => 'int',
'length' => 11,
'primary_key' => true,
public $columns = [
'id' => [
'type' => 'int',
'length' => 11,
'primary_key' => true,
'auto_increment' => true,
'default' => null,
],
'project_id' => [
'type' => 'int',
'length' => 11,
'default' => null,
),
'project_id' => array(
'type' => 'int',
'length' => 11,
],
'commit_id' => [
'type' => 'varchar',
'length' => 50,
'default' => null,
),
'commit_id' => array(
'type' => 'varchar',
'length' => 50,
],
'status' => [
'type' => 'int',
'length' => 11,
'default' => null,
),
'status' => array(
'type' => 'int',
'length' => 11,
'default' => null,
),
'log' => array(
'type' => 'mediumtext',
],
'log' => [
'type' => 'mediumtext',
'nullable' => true,
'default' => null,
),
'branch' => array(
'type' => 'varchar',
'length' => 50,
'default' => null,
],
'branch' => [
'type' => 'varchar',
'length' => 50,
'default' => 'master',
),
'created' => array(
'type' => 'datetime',
],
'created' => [
'type' => 'datetime',
'nullable' => true,
'default' => null,
),
'started' => array(
'type' => 'datetime',
'default' => null,
],
'started' => [
'type' => 'datetime',
'nullable' => true,
'default' => null,
),
'finished' => array(
'type' => 'datetime',
'default' => null,
],
'finished' => [
'type' => 'datetime',
'nullable' => true,
'default' => null,
),
'committer_email' => array(
'type' => 'varchar',
'length' => 512,
'default' => null,
],
'committer_email' => [
'type' => 'varchar',
'length' => 512,
'nullable' => true,
'default' => null,
),
'commit_message' => array(
'type' => 'text',
'default' => null,
],
'commit_message' => [
'type' => 'text',
'nullable' => true,
'default' => null,
),
'extra' => array(
'type' => 'text',
'default' => null,
],
'extra' => [
'type' => 'text',
'nullable' => true,
'default' => null,
),
);
'default' => null,
],
];
/**
* @var array
*/
public $indexes = array(
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
'project_id' => array('columns' => 'project_id'),
'idx_status' => array('columns' => 'status'),
);
public $indexes = [
'PRIMARY' => ['unique' => true, 'columns' => 'id'],
'project_id' => ['columns' => 'project_id'],
'idx_status' => ['columns' => 'status'],
];
/**
* @var array
*/
public $foreignKeys = array(
'build_ibfk_1' => array(
'local_col' => 'project_id',
'update' => 'CASCADE',
'delete' => 'CASCADE',
'table' => 'project',
'col' => 'id'
),
);
public $foreignKeys = [
'build_ibfk_1' => [
'local_col' => 'project_id',
'update' => 'CASCADE',
'delete' => 'CASCADE',
'table' => 'project',
'col' => 'id'
],
];
/**
* Get the value of Id / id.

View file

@ -17,7 +17,7 @@ class BuildErrorBase extends Model
/**
* @var array
*/
public static $sleepable = array();
public static $sleepable = [];
/**
* @var string
@ -32,131 +32,131 @@ class BuildErrorBase extends Model
/**
* @var array
*/
protected $data = array(
'id' => null,
'build_id' => null,
'plugin' => null,
'file' => null,
'line_start' => null,
'line_end' => null,
'severity' => null,
'message' => null,
protected $data = [
'id' => null,
'build_id' => null,
'plugin' => null,
'file' => null,
'line_start' => null,
'line_end' => null,
'severity' => null,
'message' => null,
'created_date' => null,
);
];
/**
* @var array
*/
protected $getters = array(
protected $getters = [
// Direct property getters:
'id' => 'getId',
'build_id' => 'getBuildId',
'plugin' => 'getPlugin',
'file' => 'getFile',
'line_start' => 'getLineStart',
'line_end' => 'getLineEnd',
'severity' => 'getSeverity',
'message' => 'getMessage',
'id' => 'getId',
'build_id' => 'getBuildId',
'plugin' => 'getPlugin',
'file' => 'getFile',
'line_start' => 'getLineStart',
'line_end' => 'getLineEnd',
'severity' => 'getSeverity',
'message' => 'getMessage',
'created_date' => 'getCreatedDate',
// Foreign key getters:
'Build' => 'getBuild',
);
];
/**
* @var array
*/
protected $setters = array(
protected $setters = [
// Direct property setters:
'id' => 'setId',
'build_id' => 'setBuildId',
'plugin' => 'setPlugin',
'file' => 'setFile',
'line_start' => 'setLineStart',
'line_end' => 'setLineEnd',
'severity' => 'setSeverity',
'message' => 'setMessage',
'id' => 'setId',
'build_id' => 'setBuildId',
'plugin' => 'setPlugin',
'file' => 'setFile',
'line_start' => 'setLineStart',
'line_end' => 'setLineEnd',
'severity' => 'setSeverity',
'message' => 'setMessage',
'created_date' => 'setCreatedDate',
// Foreign key setters:
'Build' => 'setBuild',
);
];
/**
* @var array
*/
public $columns = array(
'id' => array(
'type' => 'int',
'length' => 11,
'primary_key' => true,
public $columns = [
'id' => [
'type' => 'int',
'length' => 11,
'primary_key' => true,
'auto_increment' => true,
'default' => null,
],
'build_id' => [
'type' => 'int',
'length' => 11,
'default' => null,
),
'build_id' => array(
'type' => 'int',
'length' => 11,
],
'plugin' => [
'type' => 'varchar',
'length' => 100,
'default' => null,
),
'plugin' => array(
'type' => 'varchar',
'length' => 100,
'default' => null,
),
'file' => array(
'type' => 'varchar',
'length' => 250,
],
'file' => [
'type' => 'varchar',
'length' => 250,
'nullable' => true,
'default' => null,
),
'line_start' => array(
'type' => 'int',
'length' => 11,
'default' => null,
],
'line_start' => [
'type' => 'int',
'length' => 11,
'nullable' => true,
'default' => null,
),
'line_end' => array(
'type' => 'int',
'length' => 11,
'default' => null,
],
'line_end' => [
'type' => 'int',
'length' => 11,
'nullable' => true,
'default' => null,
],
'severity' => [
'type' => 'tinyint',
'length' => 3,
'default' => null,
),
'severity' => array(
'type' => 'tinyint',
'length' => 3,
],
'message' => [
'type' => 'varchar',
'length' => 250,
'default' => null,
),
'message' => array(
'type' => 'varchar',
'length' => 250,
],
'created_date' => [
'type' => 'datetime',
'default' => null,
),
'created_date' => array(
'type' => 'datetime',
'default' => null,
),
);
],
];
/**
* @var array
*/
public $indexes = array(
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
'build_id' => array('columns' => 'build_id, created_date'),
);
public $indexes = [
'PRIMARY' => ['unique' => true, 'columns' => 'id'],
'build_id' => ['columns' => 'build_id, created_date'],
];
/**
* @var array
*/
public $foreignKeys = array(
'build_error_ibfk_1' => array(
'local_col' => 'build_id',
'update' => 'CASCADE',
'delete' => 'CASCADE',
'table' => 'build',
'col' => 'id'
),
);
public $foreignKeys = [
'build_error_ibfk_1' => [
'local_col' => 'build_id',
'update' => 'CASCADE',
'delete' => 'CASCADE',
'table' => 'build',
'col' => 'id'
],
];
/**
* Get the value of Id / id.
@ -165,7 +165,7 @@ class BuildErrorBase extends Model
*/
public function getId()
{
$rtn = $this->data['id'];
$rtn = $this->data['id'];
return $rtn;
}
@ -177,7 +177,7 @@ class BuildErrorBase extends Model
*/
public function getBuildId()
{
$rtn = $this->data['build_id'];
$rtn = $this->data['build_id'];
return $rtn;
}
@ -189,7 +189,7 @@ class BuildErrorBase extends Model
*/
public function getPlugin()
{
$rtn = $this->data['plugin'];
$rtn = $this->data['plugin'];
return $rtn;
}
@ -201,7 +201,7 @@ class BuildErrorBase extends Model
*/
public function getFile()
{
$rtn = $this->data['file'];
$rtn = $this->data['file'];
return $rtn;
}
@ -213,7 +213,7 @@ class BuildErrorBase extends Model
*/
public function getLineStart()
{
$rtn = $this->data['line_start'];
$rtn = $this->data['line_start'];
return $rtn;
}
@ -225,7 +225,7 @@ class BuildErrorBase extends Model
*/
public function getLineEnd()
{
$rtn = $this->data['line_end'];
$rtn = $this->data['line_end'];
return $rtn;
}
@ -237,7 +237,7 @@ class BuildErrorBase extends Model
*/
public function getSeverity()
{
$rtn = $this->data['severity'];
$rtn = $this->data['severity'];
return $rtn;
}
@ -249,7 +249,7 @@ class BuildErrorBase extends Model
*/
public function getMessage()
{
$rtn = $this->data['message'];
$rtn = $this->data['message'];
return $rtn;
}
@ -261,10 +261,10 @@ class BuildErrorBase extends Model
*/
public function getCreatedDate()
{
$rtn = $this->data['created_date'];
$rtn = $this->data['created_date'];
if (!empty($rtn)) {
$rtn = new \DateTime($rtn);
$rtn = new \DateTime($rtn);
}
return $rtn;

View file

@ -17,7 +17,7 @@ class BuildMetaBase extends Model
/**
* @var array
*/
public static $sleepable = array();
public static $sleepable = [];
/**
* @var string
@ -32,106 +32,104 @@ class BuildMetaBase extends Model
/**
* @var array
*/
protected $data = array(
'id' => null,
protected $data = [
'id' => null,
'project_id' => null,
'build_id' => null,
'meta_key' => null,
'build_id' => null,
'meta_key' => null,
'meta_value' => null,
);
];
/**
* @var array
*/
protected $getters = array(
protected $getters = [
// Direct property getters:
'id' => 'getId',
'id' => 'getId',
'project_id' => 'getProjectId',
'build_id' => 'getBuildId',
'meta_key' => 'getMetaKey',
'build_id' => 'getBuildId',
'meta_key' => 'getMetaKey',
'meta_value' => 'getMetaValue',
// Foreign key getters:
'Project' => 'getProject',
'Build' => 'getBuild',
);
'Project' => 'getProject',
'Build' => 'getBuild',
];
/**
* @var array
*/
protected $setters = array(
protected $setters = [
// Direct property setters:
'id' => 'setId',
'id' => 'setId',
'project_id' => 'setProjectId',
'build_id' => 'setBuildId',
'meta_key' => 'setMetaKey',
'build_id' => 'setBuildId',
'meta_key' => 'setMetaKey',
'meta_value' => 'setMetaValue',
// Foreign key setters:
'Project' => 'setProject',
'Build' => 'setBuild',
);
'Project' => 'setProject',
'Build' => 'setBuild',
];
/**
* @var array
*/
public $columns = array(
'id' => array(
'type' => 'int',
'length' => 10,
'primary_key' => true,
public $columns = [
'id' => [
'type' => 'int',
'length' => 10,
'primary_key' => true,
'auto_increment' => true,
'default' => null,
],
'project_id' => [
'type' => 'int',
'length' => 11,
'default' => null,
),
'project_id' => array(
'type' => 'int',
'length' => 11,
],
'build_id' => [
'type' => 'int',
'length' => 11,
'default' => null,
),
'build_id' => array(
'type' => 'int',
'length' => 11,
],
'meta_key' => [
'type' => 'varchar',
'length' => 250,
'default' => null,
),
'meta_key' => array(
'type' => 'varchar',
'length' => 250,
],
'meta_value' => [
'type' => 'mediumtext',
'default' => null,
),
'meta_value' => array(
'type' => 'mediumtext',
'default' => null,
),
);
],
];
/**
* @var array
*/
public $indexes = array(
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
'idx_meta_id' => array('unique' => true, 'columns' => 'build_id, meta_key'),
'project_id' => array('columns' => 'project_id'),
);
public $indexes = [
'PRIMARY' => ['unique' => true, 'columns' => 'id'],
'idx_meta_id' => ['unique' => true, 'columns' => 'build_id, meta_key'],
'project_id' => ['columns' => 'project_id'],
];
/**
* @var array
*/
public $foreignKeys = array(
'build_meta_ibfk_1' => array(
'local_col' => 'project_id',
'update' => 'CASCADE',
'delete' => 'CASCADE',
'table' => 'project',
'col' => 'id'
),
'fk_meta_build_id' => array(
'local_col' => 'build_id',
'update' => 'CASCADE',
'delete' => 'CASCADE',
'table' => 'build',
'col' => 'id'
),
);
public $foreignKeys = [
'build_meta_ibfk_1' => [
'local_col' => 'project_id',
'update' => 'CASCADE',
'delete' => 'CASCADE',
'table' => 'project',
'col' => 'id'
],
'fk_meta_build_id' => [
'local_col' => 'build_id',
'update' => 'CASCADE',
'delete' => 'CASCADE',
'table' => 'build',
'col' => 'id'
],
];
/**
* Get the value of Id / id.

View file

@ -17,7 +17,7 @@ class ProjectBase extends Model
/**
* @var array
*/
public static $sleepable = array();
public static $sleepable = [];
/**
* @var string

View file

@ -17,7 +17,7 @@ class ProjectGroupBase extends Model
/**
* @var array
*/
public static $sleepable = array();
public static $sleepable = [];
/**
* @var string

View file

@ -17,7 +17,7 @@ class UserBase extends Model
/**
* @var array
*/
public static $sleepable = array();
public static $sleepable = [];
/**
* @var string

View file

@ -80,17 +80,17 @@ class GithubBuild extends RemoteGitBuild
$phpciUrl = \b8\Config::getInstance()->get('phpci.url');
$params = array(
'state' => $status,
'target_url' => $phpciUrl . '/build/view/' . $this->getId(),
$params = [
'state' => $status,
'target_url' => $phpciUrl . '/build/view/' . $this->getId(),
'description' => $description,
'context' => 'PHPCI',
);
'context' => 'PHPCI',
];
$headers = array(
$headers = [
'Authorization: token ' . $token,
'Content-Type: application/x-www-form-urlencoded'
);
];
$http->setHeaders($headers);
$http->request('POST', $url, json_encode($params));
@ -141,7 +141,7 @@ class GithubBuild extends RemoteGitBuild
$branch = $this->getBranch();
if ($this->getExtra('build_type') == 'pull_request') {
$matches = array();
$matches = [];
preg_match('/[\/:]([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)/', $this->getExtra('remote_url'), $matches);
$reference = $matches[1];

View file

@ -29,7 +29,7 @@ class Atoum implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;

View file

@ -38,7 +38,7 @@ class Behat implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -94,13 +94,13 @@ class Behat implements \PHPCI\Plugin
$parts = explode('---', $output);
if (count($parts) <= 1) {
return array(0, array());
return [0, []];
}
$lines = explode(PHP_EOL, $parts[1]);
$storeFailures = false;
$data = array();
$data = [];
foreach ($lines as $line) {
$line = trim($line);
@ -115,10 +115,10 @@ class Behat implements \PHPCI\Plugin
if ($storeFailures) {
$lineParts = explode(':', $line);
$data[] = array(
$data[] = [
'file' => $lineParts[0],
'line' => $lineParts[1]
);
];
$this->build->reportError(
$this->phpci,
@ -133,6 +133,6 @@ class Behat implements \PHPCI\Plugin
$errorCount = count($data);
return array($errorCount, $data);
return [$errorCount, $data];
}
}

View file

@ -36,7 +36,7 @@ class Campfire implements \PHPCI\Plugin
* @param array $options
* @throws \Exception
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -108,7 +108,7 @@ class Campfire implements \PHPCI\Plugin
$type = 'TextMessage';
}
return $this->getPageByPost($page, array('message' => array('type' => $type, 'body' => $message)));
return $this->getPageByPost($page, ['message' => ['type' => $type, 'body' => $message]]);
}
@ -134,7 +134,7 @@ class Campfire implements \PHPCI\Plugin
curl_setopt($handle, CURLOPT_VERBOSE, $this->verbose);
curl_setopt($handle, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($handle, CURLOPT_USERPWD, $this->authToken . ':x');
curl_setopt($handle, CURLOPT_HTTPHEADER, array("Content-type: application/json"));
curl_setopt($handle, CURLOPT_HTTPHEADER, ["Content-type: application/json"]);
curl_setopt($handle, CURLOPT_COOKIEFILE, $this->cookie);
curl_setopt($handle, CURLOPT_POSTFIELDS, $json);

View file

@ -37,11 +37,11 @@ class CleanBuild implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
$this->remove = isset($options['remove']) && is_array($options['remove']) ? $options['remove'] : array();
$this->remove = isset($options['remove']) && is_array($options['remove']) ? $options['remove'] : [];
}
/**

View file

@ -79,7 +79,7 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -147,11 +147,11 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin
$parser = new Parser($this->phpci, $xml);
$output = $parser->parse();
$meta = array(
$meta = [
'tests' => $parser->getTotalTests(),
'timetaken' => $parser->getTotalTimeTaken(),
'failures' => $parser->getTotalFailures()
);
];
$this->build->storeMeta('codeception-meta', $meta);
$this->build->storeMeta('codeception-data', $output);

View file

@ -53,7 +53,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$path = $phpci->buildPath;
$this->phpci = $phpci;
@ -91,7 +91,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
*/
public function execute()
{
$composerLocation = $this->phpci->findBinary(array('composer', 'composer.phar'));
$composerLocation = $this->phpci->findBinary(['composer', 'composer.phar']);
$cmd = '';

View file

@ -33,7 +33,7 @@ class CopyBuild implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$path = $phpci->buildPath;
$this->phpci = $phpci;

View file

@ -31,7 +31,7 @@ class Deployer implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -60,13 +60,13 @@ class Deployer implements \PHPCI\Plugin
$http = new HttpClient();
$response = $http->post($this->webhookUrl, array(
'reason' => $this->phpci->interpolate($this->reason),
'source' => 'PHPCI',
'url' => $this->phpci->interpolate('%BUILD_URI%'),
'branch' => $this->phpci->interpolate('%BRANCH%'),
$response = $http->post($this->webhookUrl, [
'reason' => $this->phpci->interpolate($this->reason),
'source' => 'PHPCI',
'url' => $this->phpci->interpolate('%BUILD_URI%'),
'branch' => $this->phpci->interpolate('%BRANCH%'),
'update_only' => $this->updateOnly
));
]);
return $response['success'];
}

View file

@ -50,7 +50,7 @@ class Email implements \PHPCI\Plugin
public function __construct(
Builder $phpci,
Build $build,
array $options = array()
array $options = []
) {
$this->phpci = $phpci;
$this->build = $build;
@ -161,7 +161,7 @@ class Email implements \PHPCI\Plugin
*/
protected function getEmailAddresses()
{
$addresses = array();
$addresses = [];
$committer = $this->build->getCommitterEmail();
if (isset($this->options['committer']) && !empty($committer)) {
@ -188,7 +188,7 @@ class Email implements \PHPCI\Plugin
*/
protected function getCcAddresses()
{
$ccAddresses = array();
$ccAddresses = [];
if (isset($this->options['cc'])) {
foreach ($this->options['cc'] as $address) {

View file

@ -31,7 +31,7 @@ class Env implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;

View file

@ -33,7 +33,7 @@ class FlowdockNotify implements \PHPCI\Plugin
* @param array $options
* @throws \Exception
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -65,7 +65,7 @@ class FlowdockNotify implements \PHPCI\Plugin
->setLink($this->build->getBranchLink())
->setContent($message);
if (!$push->sendTeamInboxMessage($flowMessage, array('connect_timeout' => 5000, 'timeout' => 5000))) {
if (!$push->sendTeamInboxMessage($flowMessage, ['connect_timeout' => 5000, 'timeout' => 5000])) {
throw new \Exception(sprintf('Flowdock Failed: %s', $flowMessage->getResponseErrors()));
}
return true;

View file

@ -23,7 +23,7 @@ class Git implements \PHPCI\Plugin
{
protected $phpci;
protected $build;
protected $actions = array();
protected $actions = [];
/**
* Set up the plugin, configure options, etc.
@ -31,7 +31,7 @@ class Git implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -74,7 +74,7 @@ class Git implements \PHPCI\Plugin
* @param array $options
* @return bool
*/
protected function runAction($action, array $options = array())
protected function runAction($action, array $options = [])
{
switch ($action) {
case 'merge':

View file

@ -40,7 +40,7 @@ class Grunt implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$path = $phpci->buildPath;
$this->build = $build;

View file

@ -40,7 +40,7 @@ class Gulp implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$path = $phpci->buildPath;
$this->build = $build;

View file

@ -32,7 +32,7 @@ class HipchatNotify implements \PHPCI\Plugin
* @param array $options
* @throws \Exception
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;

View file

@ -41,7 +41,7 @@ class Irc implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -79,10 +79,10 @@ class Irc implements \PHPCI\Plugin
$sock = fsockopen($this->server, $this->port);
stream_set_timeout($sock, 1);
$connectCommands = array(
$connectCommands = [
'USER ' . $this->nick . ' 0 * :' . $this->nick,
'NICK ' . $this->nick,
);
];
$this->executeIrcCommands($sock, $connectCommands);
$this->executeIrcCommand($sock, 'JOIN ' . $this->room);
$this->executeIrcCommand($sock, 'PRIVMSG ' . $this->room . ' :' . $msg);
@ -107,7 +107,7 @@ class Irc implements \PHPCI\Plugin
// almost all servers expect pingback!
while ($response = fgets($socket)) {
$matches = array();
$matches = [];
if (preg_match('/^PING \\:([A-Z0-9]+)/', $response, $matches)) {
$pingBack = $matches[1];
}
@ -127,6 +127,6 @@ class Irc implements \PHPCI\Plugin
*/
private function executeIrcCommand($socket, $command)
{
return $this->executeIrcCommands($socket, array($command));
return $this->executeIrcCommands($socket, [$command]);
}
}

View file

@ -39,11 +39,11 @@ class Lint implements PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
$this->directories = array('');
$this->directories = [''];
$this->ignore = $phpci->ignore;
if (!empty($options['directory'])) {

View file

@ -36,7 +36,7 @@ class Mysql implements \PHPCI\Plugin
/**
* @var array
*/
protected $queries = array();
protected $queries = [];
/**
* @var string
@ -58,7 +58,7 @@ class Mysql implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -97,7 +97,7 @@ class Mysql implements \PHPCI\Plugin
public function execute()
{
try {
$opts = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
$opts = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];
$pdo = new PDO('mysql:host=' . $this->host, $this->user, $this->pass, $opts);
foreach ($this->queries as $query) {
@ -152,10 +152,10 @@ class Mysql implements \PHPCI\Plugin
*/
protected function getImportCommand($import_file, $database = null)
{
$decompression = array(
$decompression = [
'bz2' => '| bzip2 --decompress',
'gz' => '| gzip --decompress',
);
'gz' => '| gzip --decompress',
];
$extension = strtolower(pathinfo($import_file, PATHINFO_EXTENSION));
$decomp_cmd = '';
@ -163,14 +163,14 @@ class Mysql implements \PHPCI\Plugin
$decomp_cmd = $decompression[$extension];
}
$args = array(
$args = [
':import_file' => escapeshellarg($import_file),
':decomp_cmd' => $decomp_cmd,
':host' => escapeshellarg($this->host),
':user' => escapeshellarg($this->user),
':pass' => escapeshellarg($this->pass),
':database' => ($database === null)? '': escapeshellarg($database),
);
':decomp_cmd' => $decomp_cmd,
':host' => escapeshellarg($this->host),
':user' => escapeshellarg($this->user),
':pass' => escapeshellarg($this->pass),
':database' => ($database === null)? '': escapeshellarg($database),
];
return strtr('cat :import_file :decomp_cmd | mysql -h:host -u:user -p:pass :database', $args);
}
}

View file

@ -31,7 +31,7 @@ class PackageBuild implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$path = $phpci->buildPath;
$this->build = $build;
@ -65,7 +65,7 @@ class PackageBuild implements \PHPCI\Plugin
chdir($this->phpci->buildPath);
if (!is_array($this->format)) {
$this->format = array($this->format);
$this->format = [$this->format];
}
foreach ($this->format as $format) {

View file

@ -54,7 +54,7 @@ class Pdepend implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -126,7 +126,7 @@ class Pdepend implements \PHPCI\Plugin
protected function removeBuildArtifacts()
{
//Remove the created files first
foreach (array($this->summary, $this->chart, $this->pyramid) as $file) {
foreach ([$this->summary, $this->chart, $this->pyramid] as $file) {
if (file_exists($this->location . DIRECTORY_SEPARATOR . $file)) {
unlink($this->location . DIRECTORY_SEPARATOR . $file);
}

View file

@ -34,7 +34,7 @@ class Pgsql implements \PHPCI\Plugin
/**
* @var array
*/
protected $queries = array();
protected $queries = [];
/**
* @var string
@ -56,7 +56,7 @@ class Pgsql implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -79,8 +79,8 @@ class Pgsql implements \PHPCI\Plugin
public function execute()
{
try {
$opts = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
$pdo = new PDO('pgsql:host=' . $this->host, $this->user, $this->pass, $opts);
$opts = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];
$pdo = new PDO('pgsql:host=' . $this->host, $this->user, $this->pass, $opts);
foreach ($this->queries as $query) {
$pdo->query($this->phpci->interpolate($query));

View file

@ -60,7 +60,7 @@ class Phar implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
// Basic
$this->phpci = $phpci;

View file

@ -24,9 +24,9 @@ class Phing implements \PHPCI\Plugin
{
private $directory;
private $buildFile = 'build.xml';
private $targets = array('build');
private $properties = array();
private $buildFile = 'build.xml';
private $targets = ['build'];
private $properties = [];
private $propertyFile;
protected $phpci;
@ -38,7 +38,7 @@ class Phing implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->setPhpci($phpci);
$this->build = $build;
@ -157,7 +157,7 @@ class Phing implements \PHPCI\Plugin
public function setTargets($targets)
{
if (is_string($targets)) {
$targets = array($targets);
$targets = [$targets];
}
$this->targets = $targets;
@ -216,7 +216,7 @@ class Phing implements \PHPCI\Plugin
$this->properties['project.basedir'] = $this->getDirectory();
}
$propertiesString = array();
$propertiesString = [];
foreach ($this->properties as $name => $value) {
$propertiesString[] = '-D' . $name . '="' . $value . '"';
@ -233,7 +233,7 @@ class Phing implements \PHPCI\Plugin
public function setProperties($properties)
{
if (is_string($properties)) {
$properties = array($properties);
$properties = [$properties];
}
$this->properties = $properties;

View file

@ -94,11 +94,11 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
* @param \PHPCI\Model\Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
$this->suffixes = array('php');
$this->suffixes = ['php'];
$this->directory = $phpci->buildPath;
$this->standard = 'PSR2';
$this->tab_width = '';
@ -134,7 +134,7 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
*/
protected function setOptions($options)
{
foreach (array('directory', 'standard', 'path', 'ignore', 'allowed_warnings', 'allowed_errors') as $key) {
foreach (['directory', 'standard', 'path', 'ignore', 'allowed_warnings', 'allowed_errors'] as $key) {
if (array_key_exists($key, $options)) {
$this->{$key} = $options[$key];
}
@ -205,7 +205,7 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
$suffixes = ' --extensions=' . implode(',', $this->suffixes);
}
return array($ignore, $standard, $suffixes);
return [$ignore, $standard, $suffixes];
}
/**
@ -241,6 +241,6 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
}
}
return array($errors, $warnings);
return [$errors, $warnings];
}
}

View file

@ -44,7 +44,7 @@ class PhpCpd implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;

View file

@ -35,7 +35,7 @@ class PhpCsFixer implements \PHPCI\Plugin
protected $level = ' --level=psr2';
protected $verbose = '';
protected $diff = '';
protected $levels = array('psr0', 'psr1', 'psr2', 'symfony');
protected $levels = ['psr0', 'psr1', 'psr2', 'symfony'];
/**
* Standard Constructor
@ -49,7 +49,7 @@ class PhpCsFixer implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;

View file

@ -67,7 +67,7 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;

View file

@ -52,7 +52,7 @@ class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -85,7 +85,7 @@ class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
$output = $this->phpci->getLastOutput();
if (preg_match_all('/\((LOC|CLOC|NCLOC|LLOC)\)\s+([0-9]+)/', $output, $matches)) {
$data = array();
$data = [];
foreach ($matches[1] as $k => $v) {
$data[$v] = (int)$matches[2][$k];
}

View file

@ -83,14 +83,14 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
$this->suffixes = array('php');
$this->suffixes = ['php'];
$this->ignore = $phpci->ignore;
$this->path = '';
$this->rules = array('codesize', 'unusedcode', 'naming');
$this->rules = ['codesize', 'unusedcode', 'naming'];
$this->allowed_warnings = 0;
if (isset($options['zero_config']) && $options['zero_config']) {
@ -105,7 +105,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
$this->allowed_warnings = (int)$options['allowed_warnings'];
}
foreach (array('rules', 'ignore', 'suffixes') as $key) {
foreach (['rules', 'ignore', 'suffixes'] as $key) {
$this->overrideSetting($options, $key);
}
}

View file

@ -53,7 +53,7 @@ class PhpParallelLint implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -87,7 +87,7 @@ class PhpParallelLint implements \PHPCI\Plugin
$output = $this->phpci->getLastOutput();
$matches = array();
$matches = [];
if (preg_match_all('/Parse error\:/', $output, $matches)) {
$this->build->storeMeta('phplint-errors', count($matches[0]));
}
@ -101,12 +101,12 @@ class PhpParallelLint implements \PHPCI\Plugin
*/
protected function getFlags()
{
$ignoreFlags = array();
$ignoreFlags = [];
foreach ($this->ignore as $ignoreDir) {
$ignoreFlags[] = '--exclude "' . $this->phpci->buildPath . $ignoreDir . '"';
}
$ignore = implode(' ', $ignoreFlags);
return array($ignore);
return [$ignore];
}
}

View file

@ -42,7 +42,7 @@ class PhpSpec implements PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -57,7 +57,7 @@ class PhpSpec implements PHPCI\Plugin
$curdir = getcwd();
chdir($this->phpci->buildPath);
$phpspec = $this->phpci->findBinary(array('phpspec', 'phpspec.php'));
$phpspec = $this->phpci->findBinary(['phpspec', 'phpspec.php']);
$success = $this->phpci->executeCommand($phpspec . ' --format=junit --no-code-generation run');
$output = $this->phpci->getLastOutput();
@ -76,47 +76,45 @@ class PhpSpec implements PHPCI\Plugin
$xml = new \SimpleXMLElement($output);
$attr = $xml->attributes();
$data = array(
'time' => (float)$attr['time'],
'tests' => (int)$attr['tests'],
$data = [
'time' => (float)$attr['time'],
'tests' => (int)$attr['tests'],
'failures' => (int)$attr['failures'],
'errors' => (int)$attr['errors'],
'errors' => (int)$attr['errors'],
// now all the tests
'suites' => array()
);
'suites' => []
];
/**
* @var \SimpleXMLElement $group
*/
foreach ($xml->xpath('testsuite') as $group) {
$attr = $group->attributes();
$suite = array(
'name' => (String)$attr['name'],
'time' => (float)$attr['time'],
'tests' => (int)$attr['tests'],
$attr = $group->attributes();
$suite = [
'name' => (String)$attr['name'],
'time' => (float)$attr['time'],
'tests' => (int)$attr['tests'],
'failures' => (int)$attr['failures'],
'errors' => (int)$attr['errors'],
'skipped' => (int)$attr['skipped'],
'errors' => (int)$attr['errors'],
'skipped' => (int)$attr['skipped'],
// now the cases
'cases' => array()
);
'cases' => []
];
/**
* @var \SimpleXMLElement $child
*/
foreach ($group->xpath('testcase') as $child) {
$attr = $child->attributes();
$case = array(
'name' => (String)$attr['name'],
$case = [
'name' => (String)$attr['name'],
'classname' => (String)$attr['classname'],
'time' => (float)$attr['time'],
'status' => (String)$attr['status'],
);
'time' => (float)$attr['time'],
'status' => (String)$attr['status'],
];
if ($case['status']=='failed') {
$error = array();
$error = [];
/*
* ok, sad, we had an error
*

View file

@ -54,7 +54,7 @@ class PhpTalLint implements PHPCI\Plugin
/**
* @var array The results of the lint scan
*/
protected $failedPaths = array();
protected $failedPaths = [];
/**
* Standard Constructor
@ -63,19 +63,19 @@ class PhpTalLint implements PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
$this->directories = array('');
$this->suffixes = array('zpt');
$this->directories = [''];
$this->suffixes = ['zpt'];
$this->ignore = $phpci->ignore;
$this->allowed_warnings = 0;
$this->allowed_errors = 0;
if (!empty($options['directory'])) {
$this->directories = array($options['directory']);
$this->directories = [$options['directory']];
}
if (isset($options['suffixes'])) {
@ -91,7 +91,7 @@ class PhpTalLint implements PHPCI\Plugin
*/
protected function setOptions($options)
{
foreach (array('directories', 'tales', 'allowed_warnings', 'allowed_errors') as $key) {
foreach (['directories', 'tales', 'allowed_warnings', 'allowed_errors'] as $key) {
if (array_key_exists($key, $options)) {
$this->{$key} = $options[$key];
}
@ -230,12 +230,12 @@ class PhpTalLint implements PHPCI\Plugin
$message = trim($parts[0]);
$line = str_replace(')', '', $parts[1]);
$this->failedPaths[] = array(
'file' => $path,
'line' => $line,
'type' => $matches[2],
$this->failedPaths[] = [
'file' => $path,
'line' => $line,
'type' => $matches[2],
'message' => $message
);
];
}
$success = false;
@ -260,6 +260,6 @@ class PhpTalLint implements PHPCI\Plugin
$suffixes = ' -e ' . implode(',', $this->suffixes);
}
return array($suffixes, $tales);
return [$suffixes, $tales];
}
}

View file

@ -103,7 +103,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -190,7 +190,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
protected function runConfigFile($configPath)
{
if (is_array($configPath)) {
return $this->recurseArg($configPath, array($this, "runConfigFile"));
return $this->recurseArg($configPath, [$this, "runConfigFile"]);
} else {
if ($this->runFrom) {
$curdir = getcwd();
@ -218,7 +218,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
protected function runDir($directory)
{
if (is_array($directory)) {
return $this->recurseArg($directory, array($this, "runDir"));
return $this->recurseArg($directory, [$this, "runDir"]);
} else {
$curdir = getcwd();
chdir($this->phpci->buildPath);

View file

@ -36,7 +36,7 @@ class Shell implements \PHPCI\Plugin
/**
* @var string[] $commands The commands to be executed
*/
protected $commands = array();
protected $commands = [];
/**
* Standard Constructor
@ -50,7 +50,7 @@ class Shell implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -58,7 +58,7 @@ class Shell implements \PHPCI\Plugin
if (isset($options['command'])) {
// Keeping this for backwards compatibility, new projects should use interpolation vars.
$options['command'] = str_replace("%buildpath%", $this->phpci->buildPath, $options['command']);
$this->commands = array($options['command']);
$this->commands = [$options['command']];
return;
}

View file

@ -33,7 +33,7 @@ class SlackNotify implements \PHPCI\Plugin
* @param array $options
* @throws \Exception
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -112,18 +112,18 @@ class SlackNotify implements \PHPCI\Plugin
}
// Build up the attachment data
$attachment = new \Maknz\Slack\Attachment(array(
$attachment = new \Maknz\Slack\Attachment([
'fallback' => $body,
'pretext' => $body,
'color' => $color,
'fields' => array(
new \Maknz\Slack\AttachmentField(array(
'fields' => [
new \Maknz\Slack\AttachmentField([
'title' => 'Status',
'value' => $status,
'short' => false
))
)
));
])
]
]);
$message->attach($attachment);

View file

@ -34,7 +34,7 @@ class Sqlite implements \PHPCI\Plugin
/**
* @var array
*/
protected $queries = array();
protected $queries = [];
/**
* @var string
@ -46,7 +46,7 @@ class Sqlite implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -66,8 +66,8 @@ class Sqlite implements \PHPCI\Plugin
public function execute()
{
try {
$opts = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
$pdo = new PDO('sqlite:' . $this->path, $opts);
$opts = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];
$pdo = new PDO('sqlite:' . $this->path, $opts);
foreach ($this->queries as $query) {
$pdo->query($this->phpci->interpolate($query));

View file

@ -81,16 +81,16 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
* @param \PHPCI\Model\Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
$this->suffixes = array('php');
$this->suffixes = ['php'];
$this->directory = $phpci->buildPath;
$this->path = '';
$this->ignore = $this->phpci->ignore;
$this->allowed_errors = 0;
$this->searches = array('TODO', 'FIXME', 'TO DO', 'FIX ME');
$this->searches = ['TODO', 'FIXME', 'TO DO', 'FIX ME'];
if (isset($options['searches']) && is_array($options['searches'])) {
$this->searches = $options['searches'];
@ -109,7 +109,7 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
*/
protected function setOptions($options)
{
foreach (array('directory', 'path', 'ignore', 'allowed_errors') as $key) {
foreach (['directory', 'path', 'ignore', 'allowed_errors'] as $key) {
if (array_key_exists($key, $options)) {
$this->{$key} = $options[$key];
}
@ -145,10 +145,10 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
public function getErrorList()
{
$dirIterator = new \RecursiveDirectoryIterator($this->directory);
$iterator = new \RecursiveIteratorIterator($dirIterator, \RecursiveIteratorIterator::SELF_FIRST);
$files = array();
$iterator = new \RecursiveIteratorIterator($dirIterator, \RecursiveIteratorIterator::SELF_FIRST);
$files = [];
$ignores = $this->ignore;
$ignores = $this->ignore;
$ignores[] = 'phpci.yml';
$ignores[] = '.phpci.yml';

View file

@ -29,7 +29,7 @@ class ComposerPluginInformation implements InstalledPluginInformation
if (file_exists($filePath)) {
$installed = json_decode(file_get_contents($filePath));
} else {
$installed = array();
$installed = [];
}
return new self($installed);
}
@ -80,7 +80,7 @@ class ComposerPluginInformation implements InstalledPluginInformation
if ($this->pluginInfo !== null) {
return;
}
$this->pluginInfo = array();
$this->pluginInfo = [];
foreach ($this->composerPackages as $package) {
$this->addPluginsFromPackage($package);
}

View file

@ -49,8 +49,8 @@ class Executor
*/
public function executePlugins(&$config, $stage)
{
$success = true;
$pluginsToExecute = array();
$success = true;
$pluginsToExecute = [];
// If we have global plugins to execute for this stage, add them to the list to be executed:
if (array_key_exists($stage, $config) && is_array($config[$stage])) {
@ -99,7 +99,7 @@ class Executor
switch ($runOption) {
// Replace standard plugin set for this stage with just the branch-specific ones:
case 'replace':
$pluginsToExecute = array();
$pluginsToExecute = [];
$pluginsToExecute[] = $plugins;
break;
@ -207,7 +207,7 @@ class Executor
$summary = $this->getBuildSummary();
if (!isset($summary[$stage][$plugin])) {
$summary[$stage][$plugin] = array();
$summary[$stage][$plugin] = [];
}
$summary[$stage][$plugin]['status'] = $status;
@ -230,7 +230,7 @@ class Executor
{
$build = $this->pluginFactory->getResourceFor('PHPCI\Model\Build');
$metas = $this->store->getMeta('plugin-summary', $build->getProjectId(), $build->getId());
return isset($metas[0]['meta_value']) ? $metas[0]['meta_value'] : array();
return isset($metas[0]['meta_value']) ? $metas[0]['meta_value'] : [];
}
/**

View file

@ -82,7 +82,7 @@ class Factory
* @throws \InvalidArgumentException if $className doesn't represent a valid plugin
* @return \PHPCI\Plugin
*/
public function buildPlugin($className, $options = array())
public function buildPlugin($className, $options = [])
{
$this->currentPluginOptions = $options;
@ -97,7 +97,7 @@ class Factory
$constructor = $reflectedPlugin->getConstructor();
if ($constructor) {
$argsToUse = array();
$argsToUse = [];
foreach ($constructor->getParameters() as $param) {
$argsToUse = $this->addArgFromParam($argsToUse, $param);
}

View file

@ -81,7 +81,7 @@ class FilesPluginInformation implements InstalledPluginInformation
*/
protected function loadPluginInfo()
{
$this->pluginInfo = array();
$this->pluginInfo = [];
foreach ($this->files as $fileInfo) {
if ($fileInfo instanceof \SplFileInfo) {
if ($fileInfo->isFile() && $fileInfo->getExtension() == 'php') {
@ -118,14 +118,14 @@ class FilesPluginInformation implements InstalledPluginInformation
protected function getFullClassFromFile(\SplFileInfo $fileInfo)
{
$contents = file_get_contents($fileInfo->getRealPath());
$matches = array();
$matches = [];
preg_match('#class +([A-Za-z]+) +implements#i', $contents, $matches);
if (isset($matches[1])) {
$className = $matches[1];
$matches = array();
$matches = [];
preg_match('#namespace +([A-Za-z\\\\]+);#i', $contents, $matches);
$namespace = $matches[1];

View file

@ -11,7 +11,7 @@ class PluginInformationCollection implements InstalledPluginInformation
/**
* @var InstalledPluginInformation[]
*/
protected $pluginInformations = array();
protected $pluginInformations = [];
/**
* Add a plugin to the collection.
@ -31,7 +31,7 @@ class PluginInformationCollection implements InstalledPluginInformation
*/
public function getInstalledPlugins()
{
$arr = array();
$arr = [];
foreach ($this->pluginInformations as $single) {
$arr = array_merge($arr, $single->getInstalledPlugins());
@ -48,7 +48,7 @@ class PluginInformationCollection implements InstalledPluginInformation
*/
public function getPluginClasses()
{
$arr = array();
$arr = [];
foreach ($this->pluginInformations as $single) {
$arr = array_merge($arr, $single->getPluginClasses());

View file

@ -68,7 +68,7 @@ class TapParser
$this->lineNumber = 0;
$this->testCount = false;
$this->results = array();
$this->results = [];
$header = $this->findTapLog();
@ -208,11 +208,11 @@ class TapParser
*/
protected function processTestLine($result, $message, $directive, $reason)
{
$test = array(
$test = [
'pass' => true,
'message' => $message,
'severity' => 'success',
);
];
if ($result !== 'ok') {
$test['pass'] = false;
@ -237,7 +237,7 @@ class TapParser
{
$startLine = $this->lineNumber + 1;
$endLine = $indent . '...';
$yamlLines = array();
$yamlLines = [];
do {
$line = $this->nextLine();

View file

@ -38,7 +38,7 @@ class Codeception implements ParserInterface
*/
public function parse()
{
$rtn = array();
$rtn = [];
$this->results = new \SimpleXMLElement($this->resultsXml);
@ -50,14 +50,14 @@ class Codeception implements ParserInterface
$this->totalErrors += (int) $testsuite['errors'];
foreach ($testsuite->testcase as $testcase) {
$testresult = array(
'suite' => (string) $testsuite['name'],
'file' => str_replace($this->phpci->buildPath, '/', (string) $testcase['file']),
'name' => (string) $testcase['name'],
'feature' => (string) $testcase['feature'],
$testresult = [
'suite' => (string) $testsuite['name'],
'file' => str_replace($this->phpci->buildPath, '/', (string) $testcase['file']),
'name' => (string) $testcase['name'],
'feature' => (string) $testcase['feature'],
'assertions' => (int) $testcase['assertions'],
'time' => (float) $testcase['time']
);
'time' => (float) $testcase['time']
];
if (isset($testcase['class'])) {
$testresult['class'] = (string) $testcase['class'];

View file

@ -38,7 +38,7 @@ class Wipe implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$path = $phpci->buildPath;
$this->phpci = $phpci;

View file

@ -65,7 +65,7 @@ class XMPP implements \PHPCI\Plugin
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
public function __construct(Builder $phpci, Build $build, array $options = [])
{
$this->phpci = $phpci;
$this->build = $build;
@ -74,7 +74,7 @@ class XMPP implements \PHPCI\Plugin
$this->password = '';
$this->server = '';
$this->alias = '';
$this->recipients = array();
$this->recipients = [];
$this->tls = false;
$this->date_format = '%c';
@ -83,7 +83,7 @@ class XMPP implements \PHPCI\Plugin
*/
if (!empty($options['recipients'])) {
if (is_string($options['recipients'])) {
$this->recipients = array($options['recipients']);
$this->recipients = [$options['recipients']];
} elseif (is_array($options['recipients'])) {
$this->recipients = $options['recipients'];
}
@ -99,7 +99,7 @@ class XMPP implements \PHPCI\Plugin
*/
protected function setOptions($options)
{
foreach (array('username', 'password', 'alias', 'tls', 'server', 'date_format') as $key) {
foreach (['username', 'password', 'alias', 'tls', 'server', 'date_format'] as $key) {
if (array_key_exists($key, $options)) {
$this->{$key} = $options[$key];
}

View file

@ -159,15 +159,15 @@ class BuildService
return;
}
$config = Config::getInstance();
$config = Config::getInstance();
$settings = $config->get('phpci.worker', []);
if (!empty($settings['host']) && !empty($settings['queue'])) {
try {
$jobData = array(
'type' => 'phpci.build',
$jobData = [
'type' => 'phpci.build',
'build_id' => $build->getId(),
);
];
if ($config->get('using_custom_file')) {
$jobData['config'] = $config->getArray();

View file

@ -34,10 +34,10 @@ class BuildStatusService
protected $url;
/** @var array */
protected $finishedStatusIds = array(
protected $finishedStatusIds = [
Build::STATUS_SUCCESS,
Build::STATUS_FAILED,
);
];
/**
* @param $branch
@ -208,15 +208,15 @@ class BuildStatusService
public function toArray()
{
if (!$this->build) {
return array();
return [];
}
return array(
'name' => $this->getName(),
'activity' => $this->getActivity(),
'lastBuildLabel' => $this->getLastBuildLabel(),
return [
'name' => $this->getName(),
'activity' => $this->getActivity(),
'lastBuildLabel' => $this->getLastBuildLabel(),
'lastBuildStatus' => $this->getLastBuildStatus(),
'lastBuildTime' => $this->getLastBuildTime(),
'webUrl' => $this->getBuildUrl(),
);
'lastBuildTime' => $this->getLastBuildTime(),
'webUrl' => $this->getBuildUrl(),
];
}
}

View file

@ -40,7 +40,7 @@ class ProjectService
* @param array $options
* @return \PHPCI\Model\Project
*/
public function createProject($title, $type, $reference, $options = array())
public function createProject($title, $type, $reference, $options = [])
{
// Create base project and use updateProject() to set its properties:
$project = new Project();
@ -56,7 +56,7 @@ class ProjectService
* @param array $options
* @return \PHPCI\Model\Project
*/
public function updateProject(Project $project, $title, $type, $reference, $options = array())
public function updateProject(Project $project, $title, $type, $reference, $options = [])
{
// Set basic properties:
$project->setTitle($title);
@ -117,11 +117,11 @@ class ProjectService
*/
protected function processAccessInformation(Project &$project)
{
$matches = array();
$matches = [];
$reference = $project->getReference();
if ($project->getType() == 'gitlab') {
$info = array();
$info = [];
if (preg_match('`^(.+)@(.+):([0-9]*)\/?(.+)\.git`', $reference, $matches)) {
$info['user'] = $matches[1];

View file

@ -77,9 +77,9 @@ class BuildErrorStoreBase extends Store
$count = count($rtn);
return array('items' => $rtn, 'count' => $count);
return ['items' => $rtn, 'count' => $count];
} else {
return array('items' => array(), 'count' => 0);
return ['items' => [], 'count' => 0];
}
}
}

View file

@ -77,9 +77,9 @@ class BuildMetaStoreBase extends Store
$count = count($rtn);
return array('items' => $rtn, 'count' => $count);
return ['items' => $rtn, 'count' => $count];
} else {
return array('items' => array(), 'count' => 0);
return ['items' => [], 'count' => 0];
}
}
@ -109,9 +109,9 @@ class BuildMetaStoreBase extends Store
$count = count($rtn);
return array('items' => $rtn, 'count' => $count);
return ['items' => $rtn, 'count' => $count];
} else {
return array('items' => array(), 'count' => 0);
return ['items' => [], 'count' => 0];
}
}
}

View file

@ -77,9 +77,9 @@ class BuildStoreBase extends Store
$count = count($rtn);
return array('items' => $rtn, 'count' => $count);
return ['items' => $rtn, 'count' => $count];
} else {
return array('items' => array(), 'count' => 0);
return ['items' => [], 'count' => 0];
}
}
@ -109,9 +109,9 @@ class BuildStoreBase extends Store
$count = count($rtn);
return array('items' => $rtn, 'count' => $count);
return ['items' => $rtn, 'count' => $count];
} else {
return array('items' => array(), 'count' => 0);
return ['items' => [], 'count' => 0];
}
}
}

View file

@ -77,9 +77,9 @@ class ProjectStoreBase extends Store
$count = count($rtn);
return array('items' => $rtn, 'count' => $count);
return ['items' => $rtn, 'count' => $count];
} else {
return array('items' => array(), 'count' => 0);
return ['items' => [], 'count' => 0];
}
}
@ -109,9 +109,9 @@ class ProjectStoreBase extends Store
$count = count($rtn);
return array('items' => $rtn, 'count' => $count);
return ['items' => $rtn, 'count' => $count];
} else {
return array('items' => array(), 'count' => 0);
return ['items' => [], 'count' => 0];
}
}
}

View file

@ -100,9 +100,9 @@ class UserStoreBase extends Store
$count = count($rtn);
return array('items' => $rtn, 'count' => $count);
return ['items' => $rtn, 'count' => $count];
} else {
return array('items' => array(), 'count' => 0);
return ['items' => [], 'count' => 0];
}
}
}

View file

@ -51,7 +51,7 @@ class BuildErrorStore extends BuildErrorStoreBase
return $rtn;
} else {
return array();
return [];
}
}

View file

@ -45,7 +45,7 @@ class BuildMetaStore extends BuildMetaStoreBase
return $rtn;
} else {
return array();
return [];
}
}
}

View file

@ -53,7 +53,7 @@ class BuildStore extends BuildStoreBase
return $rtn;
} else {
return array();
return [];
}
}
@ -75,7 +75,7 @@ class BuildStore extends BuildStoreBase
return new Build($data);
}
} else {
return array();
return [];
}
}
@ -101,9 +101,9 @@ class BuildStore extends BuildStoreBase
$rtn = array_map($map, $res);
return array('items' => $rtn, 'count' => count($rtn));
return ['items' => $rtn, 'count' => count($rtn)];
} else {
return array('items' => array(), 'count' => 0);
return ['items' => [], 'count' => 0];
}
}
@ -124,7 +124,7 @@ class BuildStore extends BuildStoreBase
$res = $stmt->fetchAll(\PDO::FETCH_COLUMN);
return $res;
} else {
return array();
return [];
}
}

View file

@ -42,7 +42,7 @@ class ProjectStore extends ProjectStoreBase
return $rtn;
} else {
return array();
return [];
}
}
@ -66,9 +66,9 @@ class ProjectStore extends ProjectStoreBase
$count = count($rtn);
return array('items' => $rtn, 'count' => $count);
return ['items' => $rtn, 'count' => $count];
} else {
return array('items' => array(), 'count' => 0);
return ['items' => [], 'count' => 0];
}
}
@ -101,9 +101,9 @@ class ProjectStore extends ProjectStoreBase
$count = count($rtn);
return array('items' => $rtn, 'count' => $count);
return ['items' => $rtn, 'count' => $count];
} else {
return array('items' => array(), 'count' => 0);
return ['items' => [], 'count' => 0];
}
}
}

View file

@ -67,7 +67,7 @@
<div class="col-lg-3 col-md-4 col-sm-4">
<?php if (in_array($project->getType(), array('github', 'gitlab', 'bitbucket'))): ?>
<?php if (in_array($project->getType(), ['github', 'gitlab', 'bitbucket'])): ?>
<div class="box box-info">
<div class="box-header">
<h4 class="box-title"><?php Lang::out('webhooks'); ?></h4>

View file

@ -2,13 +2,12 @@
use PHPCI\Helper\Lang;
foreach($projects as $project):
$statuses = array();
$statuses = [];
$failures = 0;
$subcls = 'yellow';
$cls = '';
$success = null;
$failure = null;
$subcls = 'yellow';
$cls = '';
$success = null;
$failure = null;
if (count($builds[$project->getId()])) {
// Get the most recent build status to determine the main block colour.

View file

@ -383,7 +383,7 @@ class CodeGenerationTest extends \PHPUnit_Framework_TestCase
try
{
$uno->getWhere(array('invalid_column' => 1));
$uno->getWhere(['invalid_column' => 1]);
}
catch(Exception $ex)
{
@ -392,24 +392,24 @@ class CodeGenerationTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($caught);
$res = $uno->getWhere(array('id' => 1), 1, 0, array(), 'rand', array('LEFT JOIN dos d ON d.id = uno.id'));
$res = $uno->getWhere(['id' => 1], 1, 0, [], 'rand', ['LEFT JOIN dos d ON d.id = uno.id']);
$this->assertTrue($res['count'] != 0);
$res = $uno->getWhere(array('id' => 1), 1, 0, array(), 'rand', array(), 'field_varchar');
$res = $uno->getWhere(['id' => 1], 1, 0, [], 'rand', [], 'field_varchar');
$this->assertTrue($res['count'] != 0);
$res = $uno->getWhere(array(), 1, 0, array(), 'rand', array(), null, array(array('type' => 'AND', 'query' => 'id = 1', 'params' => array())));
$res = $uno->getWhere([], 1, 0, [], 'rand', [], null, [['type' => 'AND', 'query' => 'id = 1', 'params' => []]]);
$this->assertTrue($res['count'] != 0);
$res = $uno->getWhere(array('id' => 2), 1, 0, array(), 'rand', array(), null, array(array('type' => 'AND', 'query' => 'id = ?', 'params' => array('id'))));
$res = $uno->getWhere(['id' => 2], 1, 0, [], 'rand', [], null, [['type' => 'AND', 'query' => 'id = ?', 'params' => ['id']]]);
$this->assertTrue($res['count'] == 0);
$caught = false;
try
{
$uno->getWhere(array('' => 1));
$uno->getWhere(['' => 1]);
}
catch(Exception $ex)
{
@ -610,14 +610,14 @@ class CodeGenerationTest extends \PHPUnit_Framework_TestCase
//----
// Tests for _parseWhere()
//----
$uno->setParam('where', array('id' => array(1000)));
$uno->setParam('where', ['id' => [1000]]);
$uno->setParam('neq', 'id');
$list = $uno->index();
$this->assertTrue(is_array($list));
$this->assertTrue(count($list['items']) != 0);
$uno->setParam('where', array('id' => 1000));
$uno->setParam('where', ['id' => 1000]);
$uno->setParam('fuzzy', 'id');
$list = $uno->index();

View file

@ -15,7 +15,7 @@ class DatabaseGenerationTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
Database::setDetails($this->_name, $this->_user, $this->_pass);
Database::setWriteServers(array($this->_host));
Database::setWriteServers([$this->_host]);
$this->_db = Database::getConnection('write');

View file

@ -14,7 +14,7 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase
public function testGetReadConnection()
{
Database::setDetails($this->_name, $this->_user, $this->_pass);
Database::setReadServers(array($this->_host));
Database::setReadServers([$this->_host]);
$connection = Database::getConnection('read');
@ -24,7 +24,7 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase
public function testGetWriteConnection()
{
Database::setDetails($this->_name, $this->_user, $this->_pass);
Database::setWriteServers(array($this->_host));
Database::setWriteServers([$this->_host]);
$connection = Database::getConnection('write');
@ -34,7 +34,7 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase
public function testGetDetails()
{
Database::setDetails($this->_name, $this->_user, $this->_pass);
Database::setReadServers(array('localhost'));
Database::setReadServers(['localhost']);
$details = Database::getConnection('read')->getDetails();
$this->assertTrue(is_array($details));
@ -49,7 +49,7 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase
public function testConnectionFailure()
{
Database::setDetails('non_existant', 'invalid_user', 'incorrect_password');
Database::setReadServers(array('localhost'));
Database::setReadServers(['localhost']);
Database::getConnection('read');
}
}

View file

@ -105,7 +105,7 @@ class FormTest extends \PHPUnit_Framework_TestCase
$this->assertFalse($f->validate());
$f->setValues(array('group' => array('one' => 'ONE', 'two' => 'TWO'), 'three' => 'THREE'));
$f->setValues(['group' => ['one' => 'ONE', 'two' => 'TWO'], 'three' => 'THREE']);
$values = $f->getValues();
$this->assertTrue(is_array($values));
@ -153,7 +153,7 @@ class FormTest extends \PHPUnit_Framework_TestCase
$this->assertTrue(strpos($e->render(), 'email') !== false);
$e = new Form\Element\Select();
$e->setOptions(array('key' => 'Val'));
$e->setOptions(['key' => 'Val']);
$html = $e->render();
$this->assertTrue(strpos($html, 'select') !== false);
$this->assertTrue(strpos($html, 'option') !== false);

View file

@ -25,7 +25,7 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase
public function testGet()
{
$http = new HttpClient('https://www.cloudflare.com');
$html = $http->get('overview', array('x' => 1));
$html = $http->get('overview', ['x' => 1]);
$this->assertContains('CloudFlare', $html['body']);
}
@ -41,7 +41,7 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase
public function testPost()
{
$http = new HttpClient('http://echo.jsontest.com');
$data = $http->post('/key/value', array('test' => 'x'));
$data = $http->post('/key/value', ['test' => 'x']);
$this->assertTrue(is_array($data));
}
@ -49,7 +49,7 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase
public function testPut()
{
$http = new HttpClient('http://echo.jsontest.com');
$data = $http->put('/key/value', array('test' => 'x'));
$data = $http->put('/key/value', ['test' => 'x']);
$this->assertTrue(is_array($data));
}
@ -57,7 +57,7 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase
public function testDelete()
{
$http = new HttpClient('http://echo.jsontest.com');
$data = $http->delete('/key/value', array('test' => 'x'));
$data = $http->delete('/key/value', ['test' => 'x']);
$this->assertTrue(is_array($data));
}

View file

@ -74,7 +74,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($view->render() == 'Hello ');
$view = new UserView('Hello {@who.name}');
$view->who = array('name' => 'Dan');
$view->who = ['name' => 'Dan'];
$this->assertTrue($view->render() == 'Hello Dan');
$tmp = new UserView('Hello');
@ -123,7 +123,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase
public function testUserViewLoop()
{
$view = new UserView('Hello {loop who}{@item}{/loop}');
$view->who = array('W', 'o', 'r', 'l', 'd');
$view->who = ['W', 'o', 'r', 'l', 'd'];
$this->assertTrue($view->render() == 'Hello World');
$view = new UserView('Hello {loop who}{@item}{/loop}');

View file

@ -5,7 +5,7 @@ use Generation\Model\Uno;
class ArrayPropertyModel extends Uno
{
public function __construct($initialData = array())
public function __construct($initialData = [])
{
$this->_getters['array_property'] = 'getArrayProperty';
self::$sleepable[] = 'array_property';
@ -13,6 +13,6 @@ class ArrayPropertyModel extends Uno
public function getArrayProperty()
{
return array('one' => 'two', 'three' => array('four' => 'five'));
return ['one' => 'two', 'three' => ['four' => 'five']];
}
}

View file

@ -72,7 +72,7 @@ class CreateAdminCommandTest extends \PHPUnit_Framework_TestCase
$this->dialog->expects($this->at(2))->method('askHiddenResponse')->will($this->returnValue('foobar123'));
$commandTester = $this->getCommandTester();
$commandTester->execute(array());
$commandTester->execute([]);
$this->assertEquals('User account created!' . PHP_EOL, $commandTester->getDisplay());
}

View file

@ -120,8 +120,8 @@ class InstallCommandTest extends \PHPUnit_Framework_TestCase
protected function executeWithoutParam($param = null, $dialog)
{
// Clean result variables.
$this->admin = array();
$this->config = array();
$this->admin = [];
$this->config = [];
// Get tester and execute with extracted parameters.
$commandTester = $this->getCommandTester($dialog);

View file

@ -40,8 +40,8 @@ class BuildLoggerTest extends \PHPUnit_Framework_TestCase
public function testLog_CallsWrappedLogger()
{
$level = LogLevel::NOTICE;
$message = "Testing";
$contextIn = array();
$message = "Testing";
$contextIn = [];
$this->mockLogger->log($level, $message, Argument::type('array'))
->shouldBeCalledTimes(1);
@ -51,9 +51,9 @@ class BuildLoggerTest extends \PHPUnit_Framework_TestCase
public function testLog_CallsWrappedLoggerForEachMessage()
{
$level = LogLevel::NOTICE;
$message = array("One", "Two", "Three");
$contextIn = array();
$level = LogLevel::NOTICE;
$message = ["One", "Two", "Three"];
$contextIn = [];
$this->mockLogger->log($level, "One", Argument::type('array'))
->shouldBeCalledTimes(1);
@ -69,13 +69,13 @@ class BuildLoggerTest extends \PHPUnit_Framework_TestCase
public function testLog_AddsBuildToContext()
{
$level = LogLevel::NOTICE;
$message = "Testing";
$contextIn = array();
$level = LogLevel::NOTICE;
$message = "Testing";
$contextIn = [];
$expectedContext = array(
$expectedContext = [
'build' => $this->mockBuild->reveal()
);
];
$this->mockLogger->log($level, $message, $expectedContext)
->shouldBeCalledTimes(1);

View file

@ -16,14 +16,14 @@ class LoggerConfigTest extends \PHPUnit_Framework_TestCase
{
public function testGetFor_ReturnsPSRLogger()
{
$config = new LoggerConfig(array());
$config = new LoggerConfig([]);
$logger = $config->getFor("something");
$this->assertInstanceOf('\Psr\Log\LoggerInterface', $logger);
}
public function testGetFor_ReturnsMonologInstance()
{
$config = new LoggerConfig(array());
$config = new LoggerConfig([]);
$logger = $config->getFor("something");
$this->assertInstanceOf('\Monolog\Logger', $logger);
}
@ -84,7 +84,7 @@ class LoggerConfigTest extends \PHPUnit_Framework_TestCase
public function testGetFor_SameInstance()
{
$config = new LoggerConfig(array());
$config = new LoggerConfig([]);
$logger1 = $config->getFor("something");
$logger2 = $config->getFor("something");

View file

@ -57,14 +57,14 @@ class EmailTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
$this->message = array();
$this->message = [];
$this->mailDelivered = true;
$self = $this;
$self = $this;
$this->mockProject = $this->getMock(
'\PHPCI\Model\Project',
array('getTitle'),
array(),
['getTitle'],
[],
"mockProject",
false
);
@ -75,8 +75,8 @@ class EmailTest extends \PHPUnit_Framework_TestCase
$this->mockBuild = $this->getMock(
'\PHPCI\Model\Build',
array('getLog', 'getStatus', 'getProject', 'getCommitterEmail'),
array(),
['getLog', 'getStatus', 'getProject', 'getCommitterEmail'],
[],
"mockBuild",
false
);
@ -101,12 +101,12 @@ class EmailTest extends \PHPUnit_Framework_TestCase
$this->mockCiBuilder = $this->getMock(
'\PHPCI\Builder',
array(
[
'getSystemConfig',
'getBuild',
'log'
),
array(),
],
[],
"mockBuilder_email",
false
);
@ -127,7 +127,7 @@ class EmailTest extends \PHPUnit_Framework_TestCase
);
}
protected function loadEmailPluginWithOptions($arrOptions = array(), $buildStatus = null, $mailDelivered = true)
protected function loadEmailPluginWithOptions($arrOptions = [], $buildStatus = null, $mailDelivered = true)
{
$this->mailDelivered = $mailDelivered;
@ -138,7 +138,7 @@ class EmailTest extends \PHPUnit_Framework_TestCase
}
// Reset current message.
$this->message = array();
$this->message = [];
$self = $this;

View file

@ -22,7 +22,7 @@ class PharTest extends \PHPUnit_Framework_TestCase
$this->cleanSource();
}
protected function getPlugin(array $options = array())
protected function getPlugin(array $options = [])
{
$build = $this
->getMockBuilder('PHPCI\Model\Build')

View file

@ -41,7 +41,7 @@ class ExecutorTest extends \PHPUnit_Framework_TestCase
public function testExecutePlugin_AssumesPHPCINamespaceIfNoneGiven()
{
$options = array();
$options = [];
$pluginName = 'PhpUnit';
$pluginNamespace = 'PHPCI\\Plugin\\';
@ -54,7 +54,7 @@ class ExecutorTest extends \PHPUnit_Framework_TestCase
public function testExecutePlugin_KeepsCalledNameSpace()
{
$options = array();
$options = [];
$pluginClass = $this->getFakePluginClassName('ExamplePluginFull');
$this->mockFactory->buildPlugin($pluginClass, $options)
@ -66,7 +66,7 @@ class ExecutorTest extends \PHPUnit_Framework_TestCase
public function testExecutePlugin_CallsExecuteOnFactoryBuildPlugin()
{
$options = array();
$options = [];
$pluginName = 'PhpUnit';
$build = new \PHPCI\Model\Build();
@ -81,7 +81,7 @@ class ExecutorTest extends \PHPUnit_Framework_TestCase
public function testExecutePlugin_ReturnsPluginSuccess()
{
$options = array();
$options = [];
$pluginName = 'PhpUnit';
$expectedReturnValue = true;
@ -98,7 +98,7 @@ class ExecutorTest extends \PHPUnit_Framework_TestCase
public function testExecutePlugin_LogsFailureForNonExistentClasses()
{
$options = array();
$options = [];
$pluginName = 'DOESNTEXIST';
$this->mockBuildLogger->logFailure('Plugin does not exist: ' . $pluginName)->shouldBeCalledTimes(1);
@ -108,7 +108,7 @@ class ExecutorTest extends \PHPUnit_Framework_TestCase
public function testExecutePlugin_LogsFailureWhenExceptionsAreThrownByPlugin()
{
$options = array();
$options = [];
$pluginName = 'PhpUnit';
$expectedException = new \RuntimeException("Generic Error");
@ -126,9 +126,9 @@ class ExecutorTest extends \PHPUnit_Framework_TestCase
public function testExecutePlugins_CallsEachPluginForStage()
{
$phpUnitPluginOptions = array();
$behatPluginOptions = array();
$build = new \PHPCI\Model\Build();
$phpUnitPluginOptions = [];
$behatPluginOptions = [];
$build = new \PHPCI\Model\Build();
$config = array(
'stageOne' => array(

View file

@ -184,8 +184,8 @@ class FactoryTest extends \PHPUnit_Framework_TestCase {
function () use ($self) {
return $self->getMock(
'PHPCI\Builder',
array(),
array(),
[],
[],
'',
false
);
@ -198,8 +198,8 @@ class FactoryTest extends \PHPUnit_Framework_TestCase {
function () use ($self) {
return $self->getMock(
'PHPCI\Model\Build',
array(),
array(),
[],
[],
'',
false
);

View file

@ -23,7 +23,7 @@ class ExamplePluginFull implements Plugin {
public function __construct(
Builder $phpci,
Build $build,
array $options = array()
array $options = []
)
{
$this->Options = $options;

View file

@ -81,7 +81,7 @@ TAP;
$parser = new TapParser($content);
$result = $parser->parse();
$this->assertEquals(array(), $result);
$this->assertEquals([], $result);
}
/**

View file

@ -28,7 +28,7 @@ abstract class ProcessControlTest extends \PHPUnit_Framework_TestCase
protected function startProcess()
{
$desc = array(array("pipe", "r"), array("pipe", "w"), array("pipe", "w"));
$this->pipes = array();
$this->pipes = [];
$this->process = proc_open($this->getTestCommand(), $desc, $this->pipes);
usleep(500);

View file

@ -26,10 +26,10 @@ if (!file_exists($configFile)) {
}
// Load configuration if present:
$conf = array();
$conf['b8']['app']['namespace'] = 'PHPCI';
$conf = [];
$conf['b8']['app']['namespace'] = 'PHPCI';
$conf['b8']['app']['default_controller'] = 'Home';
$conf['b8']['view']['path'] = dirname(__DIR__) . '/src/PHPCI/View/';
$conf['b8']['view']['path'] = dirname(__DIR__) . '/src/PHPCI/View/';
$config = new b8\Config($conf);