Code style fixes
This commit is contained in:
parent
6c4c669492
commit
0868eb9c69
63 changed files with 1413 additions and 1494 deletions
|
|
@ -61,8 +61,8 @@ abstract class BaseCommandExecutor implements CommandExecutor
|
|||
{
|
||||
$this->logger = $logger;
|
||||
$this->quiet = $quiet;
|
||||
$this->verbose = $verbose;
|
||||
$this->lastOutput = array();
|
||||
$this->verbose = $verbose;
|
||||
$this->lastOutput = [];
|
||||
$this->rootDir = rtrim($rootDir, '/\\') . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
|
|
@ -71,9 +71,9 @@ abstract class BaseCommandExecutor implements CommandExecutor
|
|||
* @param array $args
|
||||
* @return bool Indicates success
|
||||
*/
|
||||
public function executeCommand($args = array())
|
||||
public function executeCommand($args = [])
|
||||
{
|
||||
$this->lastOutput = array();
|
||||
$this->lastOutput = [];
|
||||
|
||||
$command = call_user_func_array('sprintf', $args);
|
||||
$this->logger->logDebug($command);
|
||||
|
|
@ -83,13 +83,13 @@ abstract class BaseCommandExecutor implements CommandExecutor
|
|||
}
|
||||
|
||||
$status = 0;
|
||||
$descriptorSpec = array(
|
||||
0 => array("pipe", "r"), // stdin
|
||||
1 => array("pipe", "w"), // stdout
|
||||
2 => array("pipe", "w"), // stderr
|
||||
);
|
||||
$descriptorSpec = [
|
||||
0 => ["pipe", "r"], // stdin
|
||||
1 => ["pipe", "w"], // stdout
|
||||
2 => ["pipe", "w"], // stderr
|
||||
];
|
||||
|
||||
$pipes = array();
|
||||
$pipes = [];
|
||||
$process = proc_open($command, $descriptorSpec, $pipes, $this->buildPath, null);
|
||||
|
||||
if (is_resource($process)) {
|
||||
|
|
@ -152,7 +152,7 @@ abstract class BaseCommandExecutor implements CommandExecutor
|
|||
$composerBin = $this->getComposerBinDir(realpath($this->buildPath));
|
||||
|
||||
if (is_string($binary)) {
|
||||
$binary = array($binary);
|
||||
$binary = [$binary];
|
||||
}
|
||||
|
||||
foreach ($binary as $bin) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class BuildInterpolator
|
|||
* @var mixed[]
|
||||
* @see setupInterpolationVars()
|
||||
*/
|
||||
protected $interpolation_vars = array();
|
||||
protected $interpolation_vars = [];
|
||||
|
||||
/**
|
||||
* Sets the variables that will be used for interpolation.
|
||||
|
|
@ -33,7 +33,7 @@ class BuildInterpolator
|
|||
*/
|
||||
public function setupInterpolationVars(Build $build, $buildPath, $phpCiUrl)
|
||||
{
|
||||
$this->interpolation_vars = array();
|
||||
$this->interpolation_vars = [];
|
||||
$this->interpolation_vars['%PHPCI%'] = 1;
|
||||
$this->interpolation_vars['%COMMIT%'] = $build->getCommitId();
|
||||
$this->interpolation_vars['%SHORT_COMMIT%'] = substr($build->getCommitId(), 0, 7);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class Diff
|
|||
return null;
|
||||
}
|
||||
|
||||
$rtn = array();
|
||||
$rtn = [];
|
||||
|
||||
$diffLines = explode(PHP_EOL, $diff);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ class Email
|
|||
{
|
||||
const DEFAULT_FROM = 'PHPCI <no-reply@phptesting.org>';
|
||||
|
||||
protected $emailTo = array();
|
||||
protected $emailCc = array();
|
||||
protected $emailTo = [];
|
||||
protected $emailCc = [];
|
||||
protected $subject = 'Email from PHPCI';
|
||||
protected $body = '';
|
||||
protected $isHtml = false;
|
||||
protected $body = '';
|
||||
protected $isHtml = false;
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
|
|
@ -126,7 +126,7 @@ class Email
|
|||
|
||||
$headers .= 'From: ' . $this->getFrom() . PHP_EOL;
|
||||
|
||||
$emailTo = array();
|
||||
$emailTo = [];
|
||||
foreach ($this->emailTo as $email => $name) {
|
||||
$thisTo = $email;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class Github
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function makeRecursiveRequest($url, $params, $results = array())
|
||||
public function makeRecursiveRequest($url, $params, $results = [])
|
||||
{
|
||||
$http = new HttpClient('https://api.github.com');
|
||||
$res = $http->get($url, $params);
|
||||
|
|
@ -80,17 +80,17 @@ class Github
|
|||
$rtn = $cache->get('phpci_github_repos');
|
||||
|
||||
if (!$rtn) {
|
||||
$orgs = $this->makeRequest('/user/orgs', array('access_token' => $token));
|
||||
$orgs = $this->makeRequest('/user/orgs', ['access_token' => $token]);
|
||||
|
||||
$params = array('type' => 'all', 'access_token' => $token);
|
||||
$repos = array('user' => array());
|
||||
$params = ['type' => 'all', 'access_token' => $token];
|
||||
$repos = ['user' => []];
|
||||
$repos['user'] = $this->makeRecursiveRequest('/user/repos', $params);
|
||||
|
||||
foreach ($orgs as $org) {
|
||||
$repos[$org['login']] = $this->makeRecursiveRequest('/orgs/'.$org['login'].'/repos', $params);
|
||||
}
|
||||
|
||||
$rtn = array();
|
||||
$rtn = [];
|
||||
foreach ($repos as $repoGroup) {
|
||||
foreach ($repoGroup as $repo) {
|
||||
$rtn['repos'][] = $repo['full_name'];
|
||||
|
|
@ -123,18 +123,18 @@ class Github
|
|||
|
||||
$url = '/repos/' . strtolower($repo) . '/pulls/' . $pullId . '/comments';
|
||||
|
||||
$params = array(
|
||||
'body' => $comment,
|
||||
$params = [
|
||||
'body' => $comment,
|
||||
'commit_id' => $commitId,
|
||||
'path' => $file,
|
||||
'position' => $line,
|
||||
);
|
||||
'path' => $file,
|
||||
'position' => $line,
|
||||
];
|
||||
|
||||
$http = new HttpClient('https://api.github.com');
|
||||
$http->setHeaders(array(
|
||||
$http->setHeaders([
|
||||
'Content-Type: application/x-www-form-urlencoded',
|
||||
'Authorization: Basic ' . base64_encode($token . ':x-oauth-basic'),
|
||||
));
|
||||
]);
|
||||
|
||||
$http->post($url, json_encode($params));
|
||||
}
|
||||
|
|
@ -158,17 +158,17 @@ class Github
|
|||
|
||||
$url = '/repos/' . strtolower($repo) . '/commits/' . $commitId . '/comments';
|
||||
|
||||
$params = array(
|
||||
'body' => $comment,
|
||||
'path' => $file,
|
||||
$params = [
|
||||
'body' => $comment,
|
||||
'path' => $file,
|
||||
'position' => $line,
|
||||
);
|
||||
];
|
||||
|
||||
$http = new HttpClient('https://api.github.com');
|
||||
$http->setHeaders(array(
|
||||
$http->setHeaders([
|
||||
'Content-Type: application/x-www-form-urlencoded',
|
||||
'Authorization: Basic ' . base64_encode($token . ':x-oauth-basic'),
|
||||
));
|
||||
]);
|
||||
|
||||
$http->post($url, json_encode($params));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,17 +26,17 @@ class Lang
|
|||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $languages = array();
|
||||
protected static $languages = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $strings = array();
|
||||
protected static $strings = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $en_strings = array();
|
||||
protected static $en_strings = [];
|
||||
|
||||
/**
|
||||
* Get a specific string from the language file.
|
||||
|
|
@ -64,7 +64,7 @@ class Lang
|
|||
*/
|
||||
public static function out()
|
||||
{
|
||||
print call_user_func_array(array('PHPCI\Helper\Lang', 'get'), func_get_args());
|
||||
print call_user_func_array(['PHPCI\Helper\Lang', 'get'], func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -102,10 +102,10 @@ class Lang
|
|||
*/
|
||||
public static function getLanguageOptions()
|
||||
{
|
||||
$languages = array();
|
||||
$languages = [];
|
||||
|
||||
foreach (self::$languages as $language) {
|
||||
$strings = array();
|
||||
$strings = [];
|
||||
require(PHPCI_DIR . 'src/PHPCI/Languages/lang.' . $language . '.php');
|
||||
$languages[$language] = $strings['language_name'];
|
||||
}
|
||||
|
|
@ -195,7 +195,7 @@ class Lang
|
|||
*/
|
||||
protected static function loadAvailableLanguages()
|
||||
{
|
||||
$matches = array();
|
||||
$matches = [];
|
||||
foreach (glob(PHPCI_DIR . 'src/PHPCI/Languages/lang.*.php') as $file) {
|
||||
if (preg_match('/lang\.([a-z]{2}\-?[a-z]*)\.php/', $file, $matches)) {
|
||||
self::$languages[] = $matches[1];
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class LoginIsDisabled
|
|||
* @param array $params
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function __call($method, $params = array())
|
||||
public function __call($method, $params = [])
|
||||
{
|
||||
unset($method, $params);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,13 +24,13 @@ class MailerFactory
|
|||
* Set the mailer factory configuration.
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
public function __construct($config = [])
|
||||
{
|
||||
if (!is_array($config)) {
|
||||
$config = array();
|
||||
$config = [];
|
||||
}
|
||||
|
||||
$this->emailConfig = isset($config['email_settings']) ? $config['email_settings'] : array();
|
||||
$this->emailConfig = isset($config['email_settings']) ? $config['email_settings'] : [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class SshKey
|
|||
mkdir($tempPath);
|
||||
}
|
||||
|
||||
$return = array('private_key' => '', 'public_key' => '');
|
||||
$return = ['private_key' => '', 'public_key' => ''];
|
||||
|
||||
$output = @shell_exec('ssh-keygen -t rsa -b 2048 -f '.$keyFile.' -N "" -C "deploy@phpci"');
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class User
|
|||
* @param array $params
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function __call($method, $params = array())
|
||||
public function __call($method, $params = [])
|
||||
{
|
||||
$user = $_SESSION['phpci_user'];
|
||||
|
||||
|
|
@ -31,6 +31,6 @@ class User
|
|||
return null;
|
||||
}
|
||||
|
||||
return call_user_func_array(array($user, $method), $params);
|
||||
return call_user_func_array([$user, $method], $params);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue