Code style and other small fixes

This commit is contained in:
Dmitry Khomutov 2016-05-09 12:20:26 +06:00
parent 17f7dd7f5d
commit 052538e99c
66 changed files with 158 additions and 124 deletions

View file

@ -53,7 +53,6 @@ class Template extends View
protected function parse($string)
{
$lastCond = null;
$keywords = ['ifnot', 'if', 'else', 'for', 'loop', '@', '/ifnot', '/if', '/for', '/loop'];
foreach (self::$templateFunctions as $function => $handler) {
@ -80,8 +79,7 @@ class Template extends View
$cond = trim($this->readUntil('}', $string));
$item['cond'] = $cond;
$lastCond = $cond;
$string = substr($string, 1);
$string = substr($string, 1);
if (array_key_exists($keyword, self::$templateFunctions)) {
$item['function_name'] = $keyword;

View file

@ -80,7 +80,7 @@ class Application extends b8\Application
/**
* Handle an incoming web request.
*
* @return b8\b8\Http\Response|Response
* @return Response
*/
public function handleRequest()
{

View file

@ -285,7 +285,7 @@ class Builder implements LoggerAwareInterface
*/
public function findBinary($binary, $quiet = false)
{
return $this->commandExecutor->findBinary($binary, $quiet = false);
return $this->commandExecutor->findBinary($binary, $quiet);
}
/**

View file

@ -192,7 +192,7 @@ class DaemonCommand extends Command
$pid = intval(trim(file_get_contents($this->pidFilePath)));
if($this->processControl->isRunning($pid, true)) {
if($this->processControl->isRunning($pid)) {
return $pid;
}

View file

@ -22,6 +22,7 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use PHPCI\Service\UserService;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Yaml\Dumper;
/**
* Install console command - Installs PHPCI.
@ -359,8 +360,8 @@ class InstallCommand extends Command
*/
protected function writeConfigFile(array $config)
{
$dumper = new \Symfony\Component\Yaml\Dumper();
$yaml = $dumper->dump($config, 4);
$dumper = new Dumper();
$yaml = $dumper->dump($config, 4);
file_put_contents($this->configFilePath, $yaml);
}

View file

@ -9,7 +9,6 @@
namespace PHPCI\Command;
use b8\Config;
use b8\Store\Factory;
use Monolog\Logger;
use PHPCI\BuildFactory;

View file

@ -120,7 +120,7 @@ class RunCommand extends Command
// After execution we no longer want to record the information
// back to this specific build so the handler should be removed.
$this->logger->popHandler($buildDbLog);
$this->logger->popHandler();
} catch (\Exception $ex) {
$build->setStatus(Build::STATUS_FAILED);
$build->setFinished(new \DateTime());

View file

@ -47,7 +47,7 @@ class UpdateCommand extends Command
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if (!$this->verifyInstalled($output)) {
if (!$this->verifyInstalled()) {
return;
}
@ -58,7 +58,7 @@ class UpdateCommand extends Command
$output->writeln('<info>'.Lang::get('ok').'</info>');
}
protected function verifyInstalled(OutputInterface $output)
protected function verifyInstalled()
{
$config = Config::getInstance();
$phpciUrl = $config->get('phpci.url');

View file

@ -85,7 +85,8 @@ class Controller extends \b8\Controller
* Handle the incoming request.
* @param $action
* @param $actionParams
* @return \b8\b8\Http\Response|Response
*
* @return Response
*/
public function handleAction($action, $actionParams)
{

View file

@ -18,6 +18,7 @@ use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Model\Project;
use PHPCI\Service\BuildService;
use PHPCI\Controller;
/**
* Build Controller - Allows users to run and view builds.
@ -25,7 +26,7 @@ use PHPCI\Service\BuildService;
* @package PHPCI
* @subpackage Web
*/
class BuildController extends \PHPCI\Controller
class BuildController extends Controller
{
/**
* @var \PHPCI\Store\BuildStore

View file

@ -16,6 +16,7 @@ use PHPCI\BuildFactory;
use PHPCI\Model\Project;
use PHPCI\Model\Build;
use PHPCI\Service\BuildStatusService;
use PHPCI\Controller;
/**
* Build Status Controller - Allows external access to build status information / images.
@ -23,7 +24,7 @@ use PHPCI\Service\BuildStatusService;
* @package PHPCI
* @subpackage Web
*/
class BuildStatusController extends \PHPCI\Controller
class BuildStatusController extends Controller
{
/* @var \PHPCI\Store\ProjectStore */
protected $projectStore;

View file

@ -13,6 +13,7 @@ use b8;
use PHPCI\BuildFactory;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Controller;
/**
* Home Controller - Displays the PHPCI Dashboard.
@ -20,7 +21,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Web
*/
class HomeController extends \PHPCI\Controller
class HomeController extends Controller
{
/**
* @var \PHPCI\Store\BuildStore

View file

@ -14,6 +14,7 @@ use PHPCI\Helper\Lang;
use PHPCI\Plugin\Util\ComposerPluginInformation;
use PHPCI\Plugin\Util\FilesPluginInformation;
use PHPCI\Plugin\Util\PluginInformationCollection;
use PHPCI\Controller;
/**
* Plugin Controller - Provides support for installing Composer packages.
@ -21,7 +22,7 @@ use PHPCI\Plugin\Util\PluginInformationCollection;
* @package PHPCI
* @subpackage Web
*/
class PluginController extends \PHPCI\Controller
class PluginController extends Controller
{
/**
* List all enabled plugins, installed and recommend packages.

View file

@ -12,6 +12,7 @@ namespace PHPCI\Controller;
use b8;
use PHPCI\Helper\Email;
use PHPCI\Helper\Lang;
use PHPCI\Controller;
/**
* Session Controller - Handles user login / logout.
@ -19,7 +20,7 @@ use PHPCI\Helper\Lang;
* @package PHPCI
* @subpackage Web
*/
class SessionController extends \PHPCI\Controller
class SessionController extends Controller
{
/**
* @var \PHPCI\Store\UserStore

View file

@ -12,11 +12,13 @@ namespace PHPCI\Controller;
use b8;
use b8\Store;
use Exception;
use PHPCI\BuildFactory;
use PHPCI\Model\Project;
use PHPCI\Service\BuildService;
use PHPCI\Store\BuildStore;
use PHPCI\Store\ProjectStore;
use b8\Controller;
use b8\Config;
use b8\HttpClient;
/**
* Webhook Controller - Processes webhook pings from BitBucket, Github, Gitlab, etc.
@ -30,7 +32,7 @@ use PHPCI\Store\ProjectStore;
*
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
*/
class WebhookController extends \b8\Controller
class WebhookController extends Controller
{
/**
* @var BuildStore
@ -170,6 +172,8 @@ class WebhookController extends \b8\Controller
* Called by POSTing to /webhook/git/<project_id>?branch=<branch>&commit=<commit>
*
* @param string $projectId
*
* @return array
*/
public function git($projectId)
{
@ -272,9 +276,13 @@ class WebhookController extends \b8\Controller
/**
* Handle the payload when Github sends a Pull Request webhook.
*
*
* @param Project $project
* @param array $payload
* @param array $payload
*
* @return array
*
* @throws Exception
*/
protected function githubPullRequest(Project $project, array $payload)
{
@ -284,18 +292,18 @@ class WebhookController extends \b8\Controller
}
$headers = [];
$token = \b8\Config::getInstance()->get('phpci.github.token');
$token = Config::getInstance()->get('phpci.github.token');
if (!empty($token)) {
$headers[] = 'Authorization: token ' . $token;
}
$url = $payload['pull_request']['commits_url'];
$http = new \b8\HttpClient();
$http = new HttpClient();
$http->setHeaders($headers);
//for large pull requests, allow grabbing more then the default number of commits
$custom_per_page = \b8\Config::getInstance()->get('phpci.github.per_page');
$custom_per_page = Config::getInstance()->get('phpci.github.per_page');
$params = [];
if ($custom_per_page) {
$params["per_page"] = $custom_per_page;

View file

@ -68,7 +68,9 @@ abstract class BaseCommandExecutor implements CommandExecutor
/**
* Executes shell commands.
*
* @param array $args
*
* @return bool Indicates success
*/
public function executeCommand($args = [])

View file

@ -14,9 +14,12 @@ interface CommandExecutor
/**
* Executes shell commands. Accepts multiple arguments the first
* is the template and everything else is inserted in. c.f. sprintf
*
* @param array $args
*
* @return bool Indicates success
*/
public function executeCommand();
public function executeCommand($args = []);
/**
* Returns the output from the last command run.
@ -25,6 +28,7 @@ interface CommandExecutor
/**
* Find a binary required by a plugin.
*
* @param string $binary
* @param bool $quiet Returns null instead of throwing an execption.
*

View file

@ -10,7 +10,6 @@
namespace PHPCI\Helper;
use b8\Config;
use PHPCI\Helper\MailerFactory;
/**
* Helper class for sending emails using PHPCI's email configuration.

View file

@ -8,6 +8,7 @@ namespace PHPCI\Model\Base;
use PHPCI\Model;
use b8\Store\Factory;
use PHPCI\Model\Project;
/**
* Build Base Model
@ -598,7 +599,7 @@ class BuildBase extends Model
public function setProject($value)
{
// Is this an instance of Project?
if ($value instanceof \PHPCI\Model\Project) {
if ($value instanceof Project) {
return $this->setProjectObject($value);
}
@ -614,9 +615,9 @@ class BuildBase extends Model
/**
* Set Project - Accepts a Project model.
*
* @param $value \PHPCI\Model\Project
* @param $value Project
*/
public function setProjectObject(\PHPCI\Model\Project $value)
public function setProjectObject(Project $value)
{
return $this->setProjectId($value->getId());
}

View file

@ -8,6 +8,7 @@ namespace PHPCI\Model\Base;
use PHPCI\Model;
use b8\Store\Factory;
use PHPCI\Model\Build;
/**
* BuildError Base Model
@ -478,7 +479,7 @@ class BuildErrorBase extends Model
public function setBuild($value)
{
// Is this an instance of Build?
if ($value instanceof \PHPCI\Model\Build) {
if ($value instanceof Build) {
return $this->setBuildObject($value);
}
@ -494,9 +495,9 @@ class BuildErrorBase extends Model
/**
* Set Build - Accepts a Build model.
*
* @param $value \PHPCI\Model\Build
* @param $value Build
*/
public function setBuildObject(\PHPCI\Model\Build $value)
public function setBuildObject(Build $value)
{
return $this->setBuildId($value->getId());
}

View file

@ -8,6 +8,8 @@ namespace PHPCI\Model\Base;
use PHPCI\Model;
use b8\Store\Factory;
use PHPCI\Model\Project;
use PHPCI\Model\Build;
/**
* BuildMeta Base Model
@ -325,7 +327,7 @@ class BuildMetaBase extends Model
public function setProject($value)
{
// Is this an instance of Project?
if ($value instanceof \PHPCI\Model\Project) {
if ($value instanceof Project) {
return $this->setProjectObject($value);
}
@ -341,9 +343,9 @@ class BuildMetaBase extends Model
/**
* Set Project - Accepts a Project model.
*
* @param $value \PHPCI\Model\Project
* @param $value Project
*/
public function setProjectObject(\PHPCI\Model\Project $value)
public function setProjectObject(Project $value)
{
return $this->setProjectId($value->getId());
}
@ -382,7 +384,7 @@ class BuildMetaBase extends Model
public function setBuild($value)
{
// Is this an instance of Build?
if ($value instanceof \PHPCI\Model\Build) {
if ($value instanceof Build) {
return $this->setBuildObject($value);
}
@ -398,9 +400,9 @@ class BuildMetaBase extends Model
/**
* Set Build - Accepts a Build model.
*
* @param $value \PHPCI\Model\Build
* @param $value Build
*/
public function setBuildObject(\PHPCI\Model\Build $value)
public function setBuildObject(Build $value)
{
return $this->setBuildId($value->getId());
}

View file

@ -8,6 +8,7 @@ namespace PHPCI\Model\Base;
use PHPCI\Model;
use b8\Store\Factory;
use PHPCI\Model\ProjectGroup;
/**
* Project Base Model
@ -628,7 +629,7 @@ class ProjectBase extends Model
public function setGroup($value)
{
// Is this an instance of ProjectGroup?
if ($value instanceof \PHPCI\Model\ProjectGroup) {
if ($value instanceof ProjectGroup) {
return $this->setGroupObject($value);
}
@ -644,9 +645,9 @@ class ProjectBase extends Model
/**
* Set Group - Accepts a ProjectGroup model.
*
* @param $value \PHPCI\Model\ProjectGroup
* @param $value ProjectGroup
*/
public function setGroupObject(\PHPCI\Model\ProjectGroup $value)
public function setGroupObject(ProjectGroup $value)
{
return $this->setGroupId($value->getId());
}

View file

@ -7,7 +7,6 @@
namespace PHPCI\Model\Base;
use PHPCI\Model;
use b8\Store\Factory;
/**
* User Base Model

View file

@ -10,7 +10,6 @@
namespace PHPCI\Model\Build;
use PHPCI\Model\Build;
use PHPCI\Model\Build\RemoteGitBuild;
/**
* BitBucket Build Model

View file

@ -12,7 +12,9 @@ namespace PHPCI\Model\Build;
use PHPCI\Builder;
use PHPCI\Helper\Diff;
use PHPCI\Helper\Github;
use PHPCI\Model\Build\RemoteGitBuild;
use b8\Config;
use b8\HttpClient;
use PHPCI\Model\BuildError;
/**
* Github Build Model
@ -43,7 +45,7 @@ class GithubBuild extends RemoteGitBuild
*/
public function sendStatusPostback()
{
$token = \b8\Config::getInstance()->get('phpci.github.token');
$token = Config::getInstance()->get('phpci.github.token');
if (empty($token) || empty($this->data['id'])) {
return;
@ -56,7 +58,7 @@ class GithubBuild extends RemoteGitBuild
}
$url = 'https://api.github.com/repos/'.$project->getReference().'/statuses/'.$this->getCommitId();
$http = new \b8\HttpClient();
$http = new HttpClient();
switch ($this->getStatus()) {
case 0:
@ -78,7 +80,7 @@ class GithubBuild extends RemoteGitBuild
break;
}
$phpciUrl = \b8\Config::getInstance()->get('phpci.url');
$phpciUrl = Config::getInstance()->get('phpci.url');
$params = [
'state' => $status,
@ -112,11 +114,12 @@ class GithubBuild extends RemoteGitBuild
/**
* Get a parsed version of the commit message, with links to issues and commits.
*
* @return string
*/
public function getCommitMessage()
{
$rtn = parent::getCommitMessage($this->data['commit_message']);
$rtn = parent::getCommitMessage();
$project = $this->getProject();

View file

@ -9,8 +9,6 @@
namespace PHPCI\Model\Build;
use PHPCI\Model\Build\RemoteGitBuild;
/**
* Gitlab Build Model
* @author André Cianfarani <a.cianfarani@c2is.fr>

View file

@ -12,12 +12,13 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* Atoum plugin, runs Atoum tests within a project.
* @package PHPCI\Plugin
*/
class Atoum implements \PHPCI\Plugin
class Atoum implements Plugin
{
private $args;
private $config;

View file

@ -13,6 +13,7 @@ use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Model\BuildError;
use PHPCI\Plugin;
/**
* Behat BDD Plugin
@ -20,7 +21,7 @@ use PHPCI\Model\BuildError;
* @package PHPCI
* @subpackage Plugins
*/
class Behat implements \PHPCI\Plugin
class Behat implements Plugin
{
protected $phpci;
protected $build;

View file

@ -12,6 +12,7 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* Campfire Plugin - Allows Campfire API actions.
@ -20,7 +21,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class Campfire implements \PHPCI\Plugin
class Campfire implements Plugin
{
private $url;
private $authToken;

View file

@ -11,6 +11,7 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* Clean build removes Composer related files and allows PHPCI users to clean up their build directory.
@ -19,7 +20,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class CleanBuild implements \PHPCI\Plugin
class CleanBuild implements Plugin
{
protected $remove;
protected $phpci;

View file

@ -14,6 +14,8 @@ use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Plugin\Util\TestResultParsers\Codeception as Parser;
use Psr\Log\LogLevel;
use PHPCI\Plugin;
use PHPCI\ZeroConfigPlugin;
/**
* Codeception Plugin - Enables full acceptance, unit, and functional testing.
@ -23,7 +25,7 @@ use Psr\Log\LogLevel;
* @package PHPCI
* @subpackage Plugins
*/
class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin
class Codeception implements Plugin, ZeroConfigPlugin
{
/** @var string */
protected $args = '';

View file

@ -12,7 +12,6 @@ namespace PHPCI\Plugin;
use PHPCI;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\Helper\Lang;
/**
* Composer Plugin - Provides access to Composer functionality.

View file

@ -12,6 +12,7 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\Helper\Lang;
use PHPCI\Plugin;
/**
* Copy Build Plugin - Copies the entire build to another directory.
@ -19,7 +20,7 @@ use PHPCI\Helper\Lang;
* @package PHPCI
* @subpackage Plugins
*/
class CopyBuild implements \PHPCI\Plugin
class CopyBuild implements Plugin
{
protected $directory;
protected $ignore;

View file

@ -12,6 +12,7 @@ namespace PHPCI\Plugin;
use b8\HttpClient;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* Integrates PHPCI with Deployer: https://github.com/rebelinblue/deployer
@ -19,7 +20,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class Deployer implements \PHPCI\Plugin
class Deployer implements Plugin
{
protected $webhookUrl;
protected $reason;

View file

@ -12,10 +12,10 @@ namespace PHPCI\Plugin;
use Exception;
use b8\View;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Helper\Email as EmailHelper;
use Psr\Log\LogLevel;
use PHPCI\Plugin;
/**
* Email Plugin - Provides simple email capability to PHPCI.
@ -23,7 +23,7 @@ use Psr\Log\LogLevel;
* @package PHPCI
* @subpackage Plugins
*/
class Email implements \PHPCI\Plugin
class Email implements Plugin
{
/**
* @var \PHPCI\Builder

View file

@ -12,6 +12,7 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* Environment variable plugin
@ -19,7 +20,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class Env implements \PHPCI\Plugin
class Env implements Plugin
{
protected $phpci;
protected $build;

View file

@ -12,6 +12,7 @@ use PHPCI\Builder;
use PHPCI\Model\Build;
use Mremi\Flowdock\Api\Push\Push;
use Mremi\Flowdock\Api\Push\TeamInboxMessage;
use PHPCI\Plugin;
/**
* Flowdock Plugin
@ -19,7 +20,7 @@ use Mremi\Flowdock\Api\Push\TeamInboxMessage;
* @package PHPCI
* @subpackage Plugins
*/
class FlowdockNotify implements \PHPCI\Plugin
class FlowdockNotify implements Plugin
{
private $api_key;
private $email;

View file

@ -12,6 +12,7 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* Git plugin.
@ -19,7 +20,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class Git implements \PHPCI\Plugin
class Git implements Plugin
{
protected $phpci;
protected $build;

View file

@ -11,6 +11,7 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* Grunt Plugin - Provides access to grunt functionality.
@ -18,7 +19,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class Grunt implements \PHPCI\Plugin
class Grunt implements Plugin
{
protected $directory;
protected $task;

View file

@ -11,6 +11,7 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* Gulp Plugin - Provides access to gulp functionality.
@ -18,7 +19,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class Gulp implements \PHPCI\Plugin
class Gulp implements Plugin
{
protected $directory;
protected $task;

View file

@ -12,6 +12,8 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Plugin;
use HipChat\HipChat;
/**
* Hipchat Plugin
@ -19,7 +21,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class HipchatNotify implements \PHPCI\Plugin
class HipchatNotify implements Plugin
{
protected $authToken;
protected $color;
@ -73,7 +75,7 @@ class HipchatNotify implements \PHPCI\Plugin
*/
public function execute()
{
$hipChat = new \HipChat\HipChat($this->authToken);
$hipChat = new HipChat($this->authToken);
$message = $this->phpci->interpolate($this->message);
$result = true;

View file

@ -12,6 +12,7 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* IRC Plugin - Sends a notification to an IRC channel
@ -19,7 +20,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class Irc implements \PHPCI\Plugin
class Irc implements Plugin
{
protected $phpci;
protected $build;

View file

@ -13,6 +13,8 @@ use PDO;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Plugin;
use b8\Database;
/**
* MySQL Plugin - Provides access to a MySQL database.
@ -21,7 +23,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class Mysql implements \PHPCI\Plugin
class Mysql implements Plugin
{
/**
* @var \PHPCI\Builder
@ -65,7 +67,7 @@ class Mysql implements \PHPCI\Plugin
$this->queries = $options;
$config = \b8\Database::getConnection('write')->getDetails();
$config = Database::getConnection('write')->getDetails();
$this->host =(defined('PHPCI_DB_HOST')) ? PHPCI_DB_HOST : null;
$this->user = $config['user'];

View file

@ -11,6 +11,7 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* Create a ZIP or TAR.GZ archive of the entire build.
@ -18,7 +19,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class PackageBuild implements \PHPCI\Plugin
class PackageBuild implements Plugin
{
protected $directory;
protected $filename;

View file

@ -10,8 +10,8 @@
namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* Pdepend Plugin - Allows Pdepend report
@ -19,7 +19,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class Pdepend implements \PHPCI\Plugin
class Pdepend implements Plugin
{
protected $args;
/**

View file

@ -12,6 +12,7 @@ namespace PHPCI\Plugin;
use PDO;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* PgSQL Plugin - Provides access to a PgSQL database.
@ -19,7 +20,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class Pgsql implements \PHPCI\Plugin
class Pgsql implements Plugin
{
/**
* @var \PHPCI\Builder

View file

@ -1,4 +1,5 @@
<?php
namespace PHPCI\Plugin;
use Exception;
@ -6,11 +7,12 @@ use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use Phar as PHPPhar;
use PHPCI\Plugin;
/**
* Phar Plugin
*/
class Phar implements \PHPCI\Plugin
class Phar implements Plugin
{
/**
* PHPCI
@ -90,7 +92,7 @@ class Phar implements \PHPCI\Plugin
/**
* Returns PHPCI
*
* @return PHPCI
* @return Builder
*/
public function getPHPCI()
{

View file

@ -12,6 +12,7 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* Phing Plugin - Provides access to Phing functionality.
@ -20,7 +21,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class Phing implements \PHPCI\Plugin
class Phing implements Plugin
{
private $directory;

View file

@ -13,6 +13,7 @@ use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Model\BuildError;
use PHPCI\Plugin;
/**
* PHP Copy / Paste Detector - Allows PHP Copy / Paste Detector testing.
@ -20,7 +21,7 @@ use PHPCI\Model\BuildError;
* @package PHPCI
* @subpackage Plugins
*/
class PhpCpd implements \PHPCI\Plugin
class PhpCpd implements Plugin
{
protected $directory;
protected $args;

View file

@ -10,8 +10,8 @@
namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* PHP CS Fixer - Works with the PHP Coding Standards Fixer for testing coding standards.
@ -19,7 +19,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class PhpCsFixer implements \PHPCI\Plugin
class PhpCsFixer implements Plugin
{
/**
* @var \PHPCI\Builder

View file

@ -10,8 +10,8 @@
namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* Php Parallel Lint Plugin - Provides access to PHP lint functionality.
@ -19,7 +19,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class PhpParallelLint implements \PHPCI\Plugin
class PhpParallelLint implements Plugin
{
/**
* @var \PHPCI\Builder

View file

@ -10,8 +10,8 @@
namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* Shell Plugin - Allows execute shell commands.
@ -19,7 +19,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class Shell implements \PHPCI\Plugin
class Shell implements Plugin
{
/**
* @var \PHPCI\Builder

View file

@ -10,6 +10,10 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\Plugin;
use Maknz\Slack\Client;
use Maknz\Slack\Attachment;
use Maknz\Slack\AttachmentField;
/**
* Slack Plugin
@ -17,7 +21,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class SlackNotify implements \PHPCI\Plugin
class SlackNotify implements Plugin
{
private $webHook;
private $room;
@ -83,7 +87,7 @@ class SlackNotify implements \PHPCI\Plugin
{
$body = $this->phpci->interpolate($this->message);
$client = new \Maknz\Slack\Client($this->webHook);
$client = new Client($this->webHook);
$message = $client->createMessage();
@ -112,12 +116,12 @@ class SlackNotify implements \PHPCI\Plugin
}
// Build up the attachment data
$attachment = new \Maknz\Slack\Attachment([
$attachment = new Attachment([
'fallback' => $body,
'pretext' => $body,
'color' => $color,
'fields' => [
new \Maknz\Slack\AttachmentField([
new AttachmentField([
'title' => 'Status',
'value' => $status,
'short' => false

View file

@ -12,6 +12,7 @@ namespace PHPCI\Plugin;
use PDO;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* SQLite Plugin Provides access to a SQLite database.
@ -19,7 +20,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class Sqlite implements \PHPCI\Plugin
class Sqlite implements Plugin
{
/**
* @var \PHPCI\Builder

View file

@ -236,7 +236,7 @@ class Executor
/**
* Sets the summary data of the current build.
*
* @param array summary
* @param array $summary
*/
private function setBuildSummary($summary)
{

View file

@ -11,6 +11,7 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* Wipe Plugin - Wipes a folder
@ -18,7 +19,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class Wipe implements \PHPCI\Plugin
class Wipe implements Plugin
{
/**
* @var \PHPCI\Builder

View file

@ -11,6 +11,7 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\Plugin;
/**
* XMPP Notification - Send notification for successful or failure build
@ -18,7 +19,7 @@ use PHPCI\Model\Build;
* @package PHPCI
* @subpackage Plugins
*/
class XMPP implements \PHPCI\Plugin
class XMPP implements Plugin
{
protected $directory;
protected $phpci;

View file

@ -19,7 +19,8 @@ class WindowsProcessControl implements ProcessControlInterface
/**
* Check if the process is running using the "tasklist" command.
*
* @param type $pid
* @param integer $pid
*
* @return bool
*/
public function isRunning($pid)
@ -32,7 +33,8 @@ class WindowsProcessControl implements ProcessControlInterface
/**
* Terminate the process using the "taskkill" command.
*
* @param type $pid
* @param integer $pid
*
* @param bool $forcefully
*/
public function kill($pid, $forcefully = false)

View file

@ -21,8 +21,9 @@ class BuildMetaStore extends BuildMetaStoreBase
{
/**
* Only used by an upgrade migration to move errors from build_meta to build_error
* @param $start
*
* @param $limit
*
* @return array
*/
public function getErrorsForUpgrade($limit)

View file

@ -47,7 +47,7 @@ class BuildStore extends BuildStoreBase
$res = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$map = function ($item) {
return new \PHPCI\Model\Build($item);
return new Build($item);
};
$rtn = array_map($map, $res);

View file

@ -90,7 +90,7 @@
<div class="container">
<div class="row" style="margin-top: 10%; text-align: center">
<a id="phpci-logo" href="https://www.phptesting.org">
<img src="<?php print PHPCI_URL; ?>/assets/img/logo-large.png">
<img src="<?php print PHPCI_URL; ?>assets/img/logo-large.png">
</a>
<div class="" id="login-box">
<?php print $content; ?>

View file

@ -90,22 +90,7 @@ foreach($projects as $project):
?>
<div class="small-box <?php print $containerClass; ?> bg-<?php print $subcls; ?>">
<?php if (count($projects) > 5): ?>
<div class="inner">
<h4>
<strong>
<a href="<?php print PHPCI_URL; ?>project/view/<?php print $project->getId(); ?>">
<?php print $project->getTitle(); ?>
</a>
</strong> -
<?php print $shortMessage; ?>
</h4>
</div>
<?php else: ?>
<div class="inner">
<h3>
<a href="<?php print PHPCI_URL; ?>project/view/<?php print $project->getId(); ?>">
@ -125,8 +110,6 @@ foreach($projects as $project):
<?php Lang::out('view_project'); ?> (<?php print $counts[$project->getId()]; ?>) <i class="fa fa-arrow-circle-right"></i>
</a>
<?php endif; ?>
<?php for ($idx=0; $idx < 5; $idx++) {
if (empty($builds[$project->getId()][$idx])) {
echo '<span class="small-box-footer-build small-box-footer bg-blue"><i class="fa fa-minus"></i></span>';

View file

@ -116,8 +116,7 @@ class BuildWorker
if (!empty($jobData['config'])) {
$this->logger->addDebug('Using job-specific config.');
$currentConfig = Config::getInstance()->getArray();
$config = new Config($jobData['config']);
Database::reset($config);
Database::reset();
}
try {
@ -138,7 +137,7 @@ class BuildWorker
// After execution we no longer want to record the information
// back to this specific build so the handler should be removed.
$this->logger->popHandler($buildDbLog);
$this->logger->popHandler();
} catch (\PDOException $ex) {
// If we've caught a PDO Exception, it is probably not the fault of the build, but of a failed
// connection or similar. Release the job and kill the worker.
@ -154,8 +153,7 @@ class BuildWorker
// Reset the config back to how it was prior to running this job:
if (!empty($currentConfig)) {
$config = new Config($currentConfig);
Database::reset($config);
Database::reset();
}
// Delete the job when we're done:

View file

@ -1 +1 @@
<?php print $action . $method; ?>
<?= $action . $method; ?>

View file

@ -1 +1 @@
<?php print $this->Format()->Currency($number, $symbol); ?>
<?= $this->Format()->Currency($number, $symbol); ?>

View file

@ -11,7 +11,6 @@ namespace PHPCI\Service\Tests;
use PHPCI\Model\Build;
use PHPCI\Model\Project;
use PHPCI\Service\BuildService;
use PHPCI\Service\BuildStatusService;
/**