PHPCS Cleanup
This commit is contained in:
parent
3e486aa943
commit
52f45a38bf
|
@ -108,9 +108,11 @@ abstract class BaseCommandExecutor implements CommandExecutor
|
|||
/**
|
||||
* Find a binary required by a plugin.
|
||||
* @param string $binary
|
||||
* @param null $buildPath
|
||||
* @return null|string
|
||||
*/
|
||||
public function findBinary($binary, $buildPath = null) {
|
||||
public function findBinary($binary, $buildPath = null)
|
||||
{
|
||||
$binaryPath = null;
|
||||
$composerBin = $this->getComposerBinDir(realpath($buildPath));
|
||||
|
||||
|
@ -154,7 +156,7 @@ abstract class BaseCommandExecutor implements CommandExecutor
|
|||
* @param string $binary
|
||||
* @return null|string
|
||||
*/
|
||||
abstract protected function findGlobalBinary($bin);
|
||||
abstract protected function findGlobalBinary($binary);
|
||||
|
||||
/**
|
||||
* Try to load the composer.json file in the building project
|
||||
|
@ -162,12 +164,13 @@ abstract class BaseCommandExecutor implements CommandExecutor
|
|||
* @param string $path Current build path
|
||||
* @return string|null
|
||||
*/
|
||||
public function getComposerBinDir($path) {
|
||||
public function getComposerBinDir($path)
|
||||
{
|
||||
if (is_dir($path)) {
|
||||
$composer = $path.'/composer.json';
|
||||
if( is_file($composer) ) {
|
||||
if (is_file($composer)) {
|
||||
$json = json_decode(file_get_contents($composer));
|
||||
if( isset($json->config->{"bin-dir"}) ) {
|
||||
if (isset($json->config->{"bin-dir"})) {
|
||||
return $path.'/'.$json->config->{"bin-dir"};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class Github
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function makeRecursiveRequest($url, $params, $results=[])
|
||||
public function makeRecursiveRequest($url, $params, $results = array())
|
||||
{
|
||||
$http = new HttpClient('https://api.github.com');
|
||||
$res = $http->get($url, $params);
|
||||
|
|
|
@ -90,7 +90,8 @@ class PhpCpd implements \PHPCI\Plugin
|
|||
|
||||
$tmpfilename = tempnam('/tmp', 'phpcpd');
|
||||
|
||||
$success = $this->phpci->executeCommand($phpcpd . ' --log-pmd="%s" %s "%s"', $tmpfilename, $ignore, $this->path);
|
||||
$cmd = $phpcpd . ' --log-pmd="%s" %s "%s"';
|
||||
$success = $this->phpci->executeCommand($cmd, $tmpfilename, $ignore, $this->path);
|
||||
|
||||
print $this->phpci->getLastOutput();
|
||||
|
||||
|
@ -134,4 +135,3 @@ class PhpCpd implements \PHPCI\Plugin
|
|||
return array($warnings, $data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,10 +81,10 @@ class XMPP implements \PHPCI\Plugin
|
|||
/*
|
||||
* Set recipients list
|
||||
*/
|
||||
if(!empty($options['recipients'])) {
|
||||
if(is_string($options['recipients'])) {
|
||||
if (!empty($options['recipients'])) {
|
||||
if (is_string($options['recipients'])) {
|
||||
$this->recipients = array($options['recipients']);
|
||||
} elseif(is_array($options['recipients'])) {
|
||||
} elseif (is_array($options['recipients'])) {
|
||||
$this->recipients = $options['recipients'];
|
||||
}
|
||||
}
|
||||
|
@ -99,8 +99,7 @@ class XMPP implements \PHPCI\Plugin
|
|||
*/
|
||||
protected function setOptions($options)
|
||||
{
|
||||
foreach (array('username', 'password', 'alias', 'tls', 'server', 'date_format')
|
||||
as $key) {
|
||||
foreach (array('username', 'password', 'alias', 'tls', 'server', 'date_format') as $key) {
|
||||
if (array_key_exists($key, $options)) {
|
||||
$this->{$key} = $options[$key];
|
||||
}
|
||||
|
@ -115,13 +114,13 @@ class XMPP implements \PHPCI\Plugin
|
|||
protected function getConfigFormat()
|
||||
{
|
||||
$conf = $this->username;
|
||||
if(!empty($this->server)) {
|
||||
if (!empty($this->server)) {
|
||||
$conf .= ';'.$this->server;
|
||||
}
|
||||
|
||||
$conf .= ' '.$this->password;
|
||||
|
||||
if(!empty($this->alias)) {
|
||||
if (!empty($this->alias)) {
|
||||
$conf .= ' '.$this->alias;
|
||||
}
|
||||
|
||||
|
@ -134,8 +133,7 @@ class XMPP implements \PHPCI\Plugin
|
|||
public function findConfigFile()
|
||||
{
|
||||
if (file_exists('.sendxmpprc')) {
|
||||
if( md5(file_get_contents('.sendxmpprc')) !==
|
||||
md5($this->getConfigFormat())) {
|
||||
if (md5(file_get_contents('.sendxmpprc')) !== md5($this->getConfigFormat())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -167,7 +165,7 @@ class XMPP implements \PHPCI\Plugin
|
|||
/*
|
||||
* Try to build conf file
|
||||
*/
|
||||
if(is_null($this->findConfigFile())) {
|
||||
if (is_null($this->findConfigFile())) {
|
||||
file_put_contents('.sendxmpprc', $this->getConfigFormat());
|
||||
chmod('.sendxmpprc', 0600);
|
||||
}
|
||||
|
@ -176,12 +174,12 @@ class XMPP implements \PHPCI\Plugin
|
|||
* Enabled ssl for connection
|
||||
*/
|
||||
$tls = '';
|
||||
if($this->tls) {
|
||||
if ($this->tls) {
|
||||
$tls = ' -t';
|
||||
}
|
||||
|
||||
$message_file = uniqid('xmppmessage');
|
||||
if($this->buildMessage($message_file) === false) {
|
||||
if ($this->buildMessage($message_file) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -191,8 +189,7 @@ class XMPP implements \PHPCI\Plugin
|
|||
$cmd = $sendxmpp . "%s -f .sendxmpprc -m %s %s";
|
||||
$recipients = implode(' ', $this->recipients);
|
||||
|
||||
$success = $this->phpci->executeCommand(
|
||||
$cmd, $tls, $message_file, $recipients);
|
||||
$success = $this->phpci->executeCommand($cmd, $tls, $message_file, $recipients);
|
||||
|
||||
print $this->phpci->getLastOutput();
|
||||
|
||||
|
@ -205,20 +202,15 @@ class XMPP implements \PHPCI\Plugin
|
|||
}
|
||||
|
||||
/**
|
||||
* Build message for notification
|
||||
*
|
||||
* @return string
|
||||
* @param $message_file
|
||||
* @return int
|
||||
*/
|
||||
protected function buildMessage($message_file)
|
||||
{
|
||||
$message = '';
|
||||
|
||||
if($this->build->isSuccessful()) {
|
||||
$message = "✔ [".$this->build->getProjectTitle()."] Build #".
|
||||
$this->build->getId()." successful";
|
||||
if ($this->build->isSuccessful()) {
|
||||
$message = "✔ [".$this->build->getProjectTitle()."] Build #" . $this->build->getId()." successful";
|
||||
} else {
|
||||
$message = "✘ [".$this->build->getProjectTitle()."] Build #".
|
||||
$this->build->getId()." failure";
|
||||
$message = "✘ [".$this->build->getProjectTitle()."] Build #" . $this->build->getId()." failure";
|
||||
}
|
||||
|
||||
$message .= ' ('.strftime($this->date_format).')';
|
||||
|
|
Loading…
Reference in a new issue