Fixing PHPCS errors.

This commit is contained in:
Dan Cryer 2015-02-26 08:45:42 +00:00
parent ab4396e00d
commit 86b9c05f98
12 changed files with 13 additions and 26 deletions

View file

@ -126,7 +126,7 @@ class PluginController extends \PHPCI\Controller
/**
* Convert array to json and save composer.json
*
*
* @param $array
*/
protected function setComposerJson($array)

View file

@ -157,6 +157,8 @@ class WebhookController extends \PHPCI\Controller
* Handle the payload when Github sends a commit webhook.
* @param $project
* @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)
{
@ -167,7 +169,6 @@ class WebhookController extends \PHPCI\Controller
}
try {
if (isset($payload['commits']) && is_array($payload['commits'])) {
// 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);
try {
// build on merge request events
if (isset($payload['object_kind']) && $payload['object_kind'] == 'merge_request') {
$attributes = $payload['object_attributes'];
if ($attributes['state'] == 'opened' || $attributes['state'] == 'reopened') {
$branch = $attributes['source_branch'];
$commit = $attributes['last_commit'];
$committer = $commit['author']['email'];

View file

@ -160,7 +160,6 @@ abstract class BaseCommandExecutor implements CommandExecutor
$this->logger->log(Lang::get('looking_for_binary', $bin), LogLevel::DEBUG);
if (is_dir($composerBin) && is_file($composerBin.'/'.$bin)) {
$this->logger->log(Lang::get('found_in_path', $composerBin, $bin), LogLevel::DEBUG);
$binaryPath = $composerBin . '/' . $bin;
break;

View file

@ -48,24 +48,18 @@ class Github
$res = $http->get($url, $params);
foreach ($res['body'] as $item) {
$results[] = $item;
}
foreach ($res['headers'] as $header) {
if (preg_match('/^Link: <([^>]+)>; rel="next"/', $header, $r)) {
$host = parse_url($r[1]);
parse_str($host['query'], $params);
$results = $this->makeRecursiveRequest($host['path'], $params, $results);
break;
}
}
return $results;

View file

@ -20,7 +20,7 @@ use b8\Config;
class LoginIsDisabled
{
/**
* Checks if
* Checks if
* @param $method
* @param array $params
* @return mixed|null

View file

@ -70,7 +70,6 @@ class Handler
public function handleError($level, $message, $file, $line)
{
if (error_reporting() & $level) {
$exception_level = isset($this->levels[$level]) ? $this->levels[$level] : $level;
throw new \ErrorException(
@ -140,7 +139,6 @@ class Handler
protected function log(\Exception $exception)
{
if (null !== $this->logger) {
$message = sprintf(
'%s: %s (uncaught exception) at %s line %s',
get_class($exception),

View file

@ -227,7 +227,6 @@ class Phar implements \PHPCI\Plugin
$success = false;
try {
$phar = new PHPPhar($this->getDirectory() . '/' . $this->getFilename(), 0, $this->getFilename());
$phar->buildFromDirectory($this->getPHPCI()->buildPath, $this->getRegExp());

View file

@ -210,7 +210,6 @@ class PhpTalLint implements PHPCI\Plugin
$output = $this->phpci->getLastOutput();
if (preg_match('/Found (.+?) (error|warning)/i', $output, $matches)) {
$rows = explode(PHP_EOL, $output);
unset($rows[0]);

View file

@ -50,10 +50,8 @@ class Executor
// Try and execute it:
if ($this->executePlugin($plugin, $options)) {
// Execution was successful:
$this->logger->logSuccess(Lang::get('plugin_success'));
} elseif ($stage == 'setup') {
// If we're in the "setup" stage, execution should not continue after
// a plugin has failed:

View file

@ -69,7 +69,7 @@ class FilesPluginInformation implements InstalledPluginInformation
{
return array_map(
function (\stdClass $plugin) {
return $plugin->class;
return $plugin->class;
},
$this->getInstalledPlugins()
);

View file

@ -16,17 +16,13 @@ if (empty($timezone)) {
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';
$configEnv = getenv('phpci_config_file');
if (!empty($configEnv)) {
if (!empty($configEnv) && file_exists($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 (!file_exists($configFile) && (!defined('PHPCI_IS_CONSOLE') || !PHPCI_IS_CONSOLE)) {
$message = 'PHPCI has not yet been installed - Please use the command "./console phpci:install" ';

View file

@ -29,3 +29,9 @@ if (!defined('PHPCI_IS_CONSOLE')) {
if (!defined('IS_WIN')) {
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);
}