Fixing PHPCS errors.
This commit is contained in:
parent
ab4396e00d
commit
86b9c05f98
|
@ -126,7 +126,7 @@ class PluginController extends \PHPCI\Controller
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert array to json and save composer.json
|
* Convert array to json and save composer.json
|
||||||
*
|
*
|
||||||
* @param $array
|
* @param $array
|
||||||
*/
|
*/
|
||||||
protected function setComposerJson($array)
|
protected function setComposerJson($array)
|
||||||
|
|
|
@ -157,6 +157,8 @@ class WebhookController extends \PHPCI\Controller
|
||||||
* Handle the payload when Github sends a commit webhook.
|
* Handle the payload when Github sends a commit webhook.
|
||||||
* @param $project
|
* @param $project
|
||||||
* @param array $payload
|
* @param array $payload
|
||||||
|
* @param b8\Http\Response\JsonResponse $response
|
||||||
|
* @return b8\Http\Response\JsonResponse
|
||||||
*/
|
*/
|
||||||
protected function githubCommitRequest($project, array $payload, b8\Http\Response\JsonResponse $response)
|
protected function githubCommitRequest($project, array $payload, b8\Http\Response\JsonResponse $response)
|
||||||
{
|
{
|
||||||
|
@ -167,7 +169,6 @@ class WebhookController extends \PHPCI\Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (isset($payload['commits']) && is_array($payload['commits'])) {
|
if (isset($payload['commits']) && is_array($payload['commits'])) {
|
||||||
// If we have a list of commits, then add them all as builds to be tested:
|
// If we have a list of commits, then add them all as builds to be tested:
|
||||||
|
|
||||||
|
@ -265,13 +266,10 @@ class WebhookController extends \PHPCI\Controller
|
||||||
$payload = json_decode($payloadString, true);
|
$payload = json_decode($payloadString, true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
// build on merge request events
|
// build on merge request events
|
||||||
if (isset($payload['object_kind']) && $payload['object_kind'] == 'merge_request') {
|
if (isset($payload['object_kind']) && $payload['object_kind'] == 'merge_request') {
|
||||||
$attributes = $payload['object_attributes'];
|
$attributes = $payload['object_attributes'];
|
||||||
if ($attributes['state'] == 'opened' || $attributes['state'] == 'reopened') {
|
if ($attributes['state'] == 'opened' || $attributes['state'] == 'reopened') {
|
||||||
|
|
||||||
$branch = $attributes['source_branch'];
|
$branch = $attributes['source_branch'];
|
||||||
$commit = $attributes['last_commit'];
|
$commit = $attributes['last_commit'];
|
||||||
$committer = $commit['author']['email'];
|
$committer = $commit['author']['email'];
|
||||||
|
|
|
@ -160,7 +160,6 @@ abstract class BaseCommandExecutor implements CommandExecutor
|
||||||
$this->logger->log(Lang::get('looking_for_binary', $bin), LogLevel::DEBUG);
|
$this->logger->log(Lang::get('looking_for_binary', $bin), LogLevel::DEBUG);
|
||||||
|
|
||||||
if (is_dir($composerBin) && is_file($composerBin.'/'.$bin)) {
|
if (is_dir($composerBin) && is_file($composerBin.'/'.$bin)) {
|
||||||
|
|
||||||
$this->logger->log(Lang::get('found_in_path', $composerBin, $bin), LogLevel::DEBUG);
|
$this->logger->log(Lang::get('found_in_path', $composerBin, $bin), LogLevel::DEBUG);
|
||||||
$binaryPath = $composerBin . '/' . $bin;
|
$binaryPath = $composerBin . '/' . $bin;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -48,24 +48,18 @@ class Github
|
||||||
$res = $http->get($url, $params);
|
$res = $http->get($url, $params);
|
||||||
|
|
||||||
foreach ($res['body'] as $item) {
|
foreach ($res['body'] as $item) {
|
||||||
|
|
||||||
$results[] = $item;
|
$results[] = $item;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($res['headers'] as $header) {
|
foreach ($res['headers'] as $header) {
|
||||||
|
|
||||||
if (preg_match('/^Link: <([^>]+)>; rel="next"/', $header, $r)) {
|
if (preg_match('/^Link: <([^>]+)>; rel="next"/', $header, $r)) {
|
||||||
|
|
||||||
$host = parse_url($r[1]);
|
$host = parse_url($r[1]);
|
||||||
|
|
||||||
parse_str($host['query'], $params);
|
parse_str($host['query'], $params);
|
||||||
$results = $this->makeRecursiveRequest($host['path'], $params, $results);
|
$results = $this->makeRecursiveRequest($host['path'], $params, $results);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
|
|
|
@ -20,7 +20,7 @@ use b8\Config;
|
||||||
class LoginIsDisabled
|
class LoginIsDisabled
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Checks if
|
* Checks if
|
||||||
* @param $method
|
* @param $method
|
||||||
* @param array $params
|
* @param array $params
|
||||||
* @return mixed|null
|
* @return mixed|null
|
||||||
|
|
|
@ -70,7 +70,6 @@ class Handler
|
||||||
public function handleError($level, $message, $file, $line)
|
public function handleError($level, $message, $file, $line)
|
||||||
{
|
{
|
||||||
if (error_reporting() & $level) {
|
if (error_reporting() & $level) {
|
||||||
|
|
||||||
$exception_level = isset($this->levels[$level]) ? $this->levels[$level] : $level;
|
$exception_level = isset($this->levels[$level]) ? $this->levels[$level] : $level;
|
||||||
|
|
||||||
throw new \ErrorException(
|
throw new \ErrorException(
|
||||||
|
@ -140,7 +139,6 @@ class Handler
|
||||||
protected function log(\Exception $exception)
|
protected function log(\Exception $exception)
|
||||||
{
|
{
|
||||||
if (null !== $this->logger) {
|
if (null !== $this->logger) {
|
||||||
|
|
||||||
$message = sprintf(
|
$message = sprintf(
|
||||||
'%s: %s (uncaught exception) at %s line %s',
|
'%s: %s (uncaught exception) at %s line %s',
|
||||||
get_class($exception),
|
get_class($exception),
|
||||||
|
|
|
@ -227,7 +227,6 @@ class Phar implements \PHPCI\Plugin
|
||||||
$success = false;
|
$success = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$phar = new PHPPhar($this->getDirectory() . '/' . $this->getFilename(), 0, $this->getFilename());
|
$phar = new PHPPhar($this->getDirectory() . '/' . $this->getFilename(), 0, $this->getFilename());
|
||||||
$phar->buildFromDirectory($this->getPHPCI()->buildPath, $this->getRegExp());
|
$phar->buildFromDirectory($this->getPHPCI()->buildPath, $this->getRegExp());
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,6 @@ class PhpTalLint implements PHPCI\Plugin
|
||||||
$output = $this->phpci->getLastOutput();
|
$output = $this->phpci->getLastOutput();
|
||||||
|
|
||||||
if (preg_match('/Found (.+?) (error|warning)/i', $output, $matches)) {
|
if (preg_match('/Found (.+?) (error|warning)/i', $output, $matches)) {
|
||||||
|
|
||||||
$rows = explode(PHP_EOL, $output);
|
$rows = explode(PHP_EOL, $output);
|
||||||
|
|
||||||
unset($rows[0]);
|
unset($rows[0]);
|
||||||
|
|
|
@ -50,10 +50,8 @@ class Executor
|
||||||
|
|
||||||
// Try and execute it:
|
// Try and execute it:
|
||||||
if ($this->executePlugin($plugin, $options)) {
|
if ($this->executePlugin($plugin, $options)) {
|
||||||
|
|
||||||
// Execution was successful:
|
// Execution was successful:
|
||||||
$this->logger->logSuccess(Lang::get('plugin_success'));
|
$this->logger->logSuccess(Lang::get('plugin_success'));
|
||||||
|
|
||||||
} elseif ($stage == 'setup') {
|
} elseif ($stage == 'setup') {
|
||||||
// If we're in the "setup" stage, execution should not continue after
|
// If we're in the "setup" stage, execution should not continue after
|
||||||
// a plugin has failed:
|
// a plugin has failed:
|
||||||
|
|
|
@ -69,7 +69,7 @@ class FilesPluginInformation implements InstalledPluginInformation
|
||||||
{
|
{
|
||||||
return array_map(
|
return array_map(
|
||||||
function (\stdClass $plugin) {
|
function (\stdClass $plugin) {
|
||||||
return $plugin->class;
|
return $plugin->class;
|
||||||
},
|
},
|
||||||
$this->getInstalledPlugins()
|
$this->getInstalledPlugins()
|
||||||
);
|
);
|
||||||
|
|
|
@ -16,17 +16,13 @@ if (empty($timezone)) {
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the PHPCI config file is not where we expect it, try looking in
|
|
||||||
// env for an alternative config path.
|
|
||||||
$configFile = dirname(__FILE__) . '/PHPCI/config.yml';
|
$configFile = dirname(__FILE__) . '/PHPCI/config.yml';
|
||||||
|
|
||||||
$configEnv = getenv('phpci_config_file');
|
$configEnv = getenv('phpci_config_file');
|
||||||
if (!empty($configEnv)) {
|
|
||||||
|
if (!empty($configEnv) && file_exists($configEnv)) {
|
||||||
$configFile = $configEnv;
|
$configFile = $configEnv;
|
||||||
}
|
}
|
||||||
|
|
||||||
define('PHPCI_CONFIG_FILE', $configFile);
|
|
||||||
|
|
||||||
// If we don't have a config file at all, fail at this point and tell the user to install:
|
// If we don't have a config file at all, fail at this point and tell the user to install:
|
||||||
if (!file_exists($configFile) && (!defined('PHPCI_IS_CONSOLE') || !PHPCI_IS_CONSOLE)) {
|
if (!file_exists($configFile) && (!defined('PHPCI_IS_CONSOLE') || !PHPCI_IS_CONSOLE)) {
|
||||||
$message = 'PHPCI has not yet been installed - Please use the command "./console phpci:install" ';
|
$message = 'PHPCI has not yet been installed - Please use the command "./console phpci:install" ';
|
||||||
|
|
6
vars.php
6
vars.php
|
@ -29,3 +29,9 @@ if (!defined('PHPCI_IS_CONSOLE')) {
|
||||||
if (!defined('IS_WIN')) {
|
if (!defined('IS_WIN')) {
|
||||||
define('IS_WIN', ((strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true : false));
|
define('IS_WIN', ((strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true : false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If an environment variable is set defining our config location, use that
|
||||||
|
// otherwise fall back to PHPCI/config.yml.
|
||||||
|
if (!defined('PHPCI_CONFIG_FILE')) {
|
||||||
|
define('PHPCI_CONFIG_FILE', $configFile);
|
||||||
|
}
|
Loading…
Reference in a new issue