From 4e68eb718034ac39320197f96add0bf50c7f9e92 Mon Sep 17 00:00:00 2001 From: Dmitry Khomutov Date: Sun, 5 Nov 2017 21:48:36 +0700 Subject: [PATCH] Code style fixes. --- src/B8Framework/Application.php | 40 ++++++--- src/B8Framework/Cache.php | 8 +- src/B8Framework/Config.php | 50 +++++++++-- src/B8Framework/Controller.php | 35 +++++--- src/B8Framework/Database.php | 2 +- src/B8Framework/Exception/HttpException.php | 18 +++- .../HttpException/BadRequestException.php | 9 +- .../HttpException/ForbiddenException.php | 9 +- .../HttpException/NotAuthorizedException.php | 9 +- .../HttpException/NotFoundException.php | 9 +- .../HttpException/ValidationException.php | 9 +- src/B8Framework/Form.php | 27 +++++- src/B8Framework/Form/Element.php | 81 ++++++++++++++++- src/B8Framework/Form/Element/Button.php | 10 ++- src/B8Framework/Form/Element/Checkbox.php | 25 +++++- src/B8Framework/Form/Element/Csrf.php | 13 ++- src/B8Framework/Form/Element/Email.php | 9 ++ src/B8Framework/Form/Element/Password.php | 9 ++ src/B8Framework/Form/Element/Select.php | 13 ++- src/B8Framework/Form/Element/Submit.php | 12 +++ src/B8Framework/Form/Element/Text.php | 7 +- src/B8Framework/Form/Element/TextArea.php | 13 +++ src/B8Framework/Form/Element/Url.php | 9 ++ src/B8Framework/Form/FieldSet.php | 28 +++++- src/B8Framework/Form/Input.php | 89 +++++++++++++++++-- src/B8Framework/Form/View/Button.phtml | 2 +- src/B8Framework/Form/View/Checkbox.phtml | 14 +-- src/B8Framework/Form/View/CheckboxGroup.phtml | 6 +- src/B8Framework/Form/View/ControlGroup.phtml | 4 +- src/B8Framework/Form/View/Csrf.phtml | 2 +- src/B8Framework/Form/View/FieldSet.phtml | 6 +- src/B8Framework/Form/View/Form.phtml | 4 +- src/B8Framework/Form/View/Hidden.phtml | 2 +- src/B8Framework/Form/View/Radio.phtml | 18 ++-- src/B8Framework/Form/View/Select.phtml | 11 +-- src/B8Framework/Form/View/Text.phtml | 15 ++-- src/B8Framework/Form/View/TextArea.phtml | 10 +-- src/B8Framework/Model.php | 1 - src/B8Framework/Store.php | 68 +++++++++++++- src/PHPCensor/Application.php | 11 ++- src/PHPCensor/BuildFactory.php | 14 +-- src/PHPCensor/Builder.php | 36 ++++++-- src/PHPCensor/BuilderException.php | 3 +- src/PHPCensor/Command/InstallCommand.php | 16 ++-- src/PHPCensor/Command/RebuildCommand.php | 2 +- src/PHPCensor/Controller.php | 18 ++-- .../Controller/BuildStatusController.php | 8 +- .../Controller/ProjectController.php | 4 +- .../Controller/WebhookController.php | 16 ++-- src/PHPCensor/Helper/BuildInterpolator.php | 2 +- src/PHPCensor/Helper/CommandExecutor.php | 15 +++- .../Helper/CommandExecutorInterface.php | 4 +- src/PHPCensor/Helper/LoginIsDisabled.php | 4 +- .../20150308074509_add_user_providers.php | 6 -- src/PHPCensor/Model.php | 1 - src/PHPCensor/Model/Build/GithubBuild.php | 4 +- src/PHPCensor/Plugin.php | 4 +- src/PHPCensor/Plugin/Atoum.php | 2 +- src/PHPCensor/Plugin/Email.php | 4 +- src/PHPCensor/Plugin/Mysql.php | 4 +- src/PHPCensor/Plugin/PhpCpd.php | 10 +-- src/PHPCensor/Plugin/PhpMessDetector.php | 6 +- src/PHPCensor/Plugin/Shell.php | 2 +- src/PHPCensor/Plugin/Util/Executor.php | 4 +- src/PHPCensor/ProcessControl/Factory.php | 2 +- .../ProcessControl/PosixProcessControl.php | 2 +- .../ProcessControlInterface.php | 2 +- .../ProcessControl/UnixProcessControl.php | 1 + .../LoginPasswordProviderInterface.php | 7 +- .../Security/Authentication/Service.php | 21 +++-- .../UserProvider/AbstractProvider.php | 2 +- .../Authentication/UserProvider/Internal.php | 11 +++ .../Authentication/UserProvider/Ldap.php | 11 +++ .../Authentication/UserProviderInterface.php | 6 +- src/PHPCensor/Service/BuildService.php | 9 +- src/PHPCensor/Service/BuildStatusService.php | 38 +++++--- src/PHPCensor/Service/ProjectService.php | 6 ++ src/PHPCensor/Service/UserService.php | 24 ++--- src/PHPCensor/Store.php | 1 - src/PHPCensor/Store/BuildErrorStore.php | 15 +++- src/PHPCensor/Store/BuildErrorWriter.php | 17 ++-- src/PHPCensor/Store/BuildMetaStore.php | 17 +++- src/PHPCensor/Store/BuildStore.php | 21 ++++- src/PHPCensor/Store/EnvironmentStore.php | 11 +++ src/PHPCensor/Store/ProjectGroupStore.php | 11 +++ src/PHPCensor/Store/ProjectStore.php | 18 +++- src/PHPCensor/Store/UserStore.php | 11 +++ src/PHPCensor/Worker/BuildWorker.php | 16 ++-- src/PHPCensor/ZeroConfigPluginInterface.php | 7 ++ 89 files changed, 942 insertions(+), 251 deletions(-) diff --git a/src/B8Framework/Application.php b/src/B8Framework/Application.php index c86c00df..774a46e4 100644 --- a/src/B8Framework/Application.php +++ b/src/B8Framework/Application.php @@ -20,20 +20,25 @@ class Application protected $controller; /** - * @var Request - */ + * @var Request + */ protected $request; /** - * @var Response - */ + * @var Response + */ protected $response; /** - * @var Config - */ + * @var Config + */ protected $config; + /** + * @param Config $config + * + * @param Request|null $request + */ public function __construct(Config $config, Http\Request $request = null) { $this->config = $config; @@ -52,6 +57,11 @@ class Application } } + /** + * @return Response + * + * @throws NotFoundException + */ public function handleRequest() { $this->route = $this->router->dispatch(); @@ -90,7 +100,7 @@ class Application /** * @param string $class - * + * * @return Controller */ protected function loadController($class) @@ -102,7 +112,7 @@ class Application /** * @param array $route - * + * * @return bool */ protected function controllerExists($route) @@ -112,7 +122,7 @@ class Application /** * @param array $route - * + * * @return string */ protected function getControllerClass($route) @@ -122,7 +132,12 @@ class Application return $this->config->get('b8.app.namespace') . '\\' . $namespace . '\\' . $controller . 'Controller'; } - public function isValidRoute($route) + /** + * @param array $route + * + * @return boolean + */ + public function isValidRoute(array $route) { if ($this->controllerExists($route)) { return true; @@ -131,6 +146,11 @@ class Application return false; } + /** + * @param string $string + * + * @return string + */ protected function toPhpName($string) { $string = str_replace('-', ' ', $string); diff --git a/src/B8Framework/Cache.php b/src/B8Framework/Cache.php index 078f1a52..0fc477cd 100644 --- a/src/B8Framework/Cache.php +++ b/src/B8Framework/Cache.php @@ -2,16 +2,14 @@ namespace b8; -/** - * @package b8 - * @subpackage Cache - */ - class Cache { const TYPE_APC = 'ApcCache'; const TYPE_REQUEST = 'RequestCache'; + /** + * @var array + */ protected static $instance = []; /** diff --git a/src/B8Framework/Config.php b/src/B8Framework/Config.php index 41d7c1b2..977abb0a 100644 --- a/src/B8Framework/Config.php +++ b/src/B8Framework/Config.php @@ -10,8 +10,14 @@ if (!defined('B8_PATH')) { class Config { + /** + * @var Config + */ protected static $instance; + /** + * @return Config + */ public static function getInstance() { return self::$instance; @@ -22,6 +28,9 @@ class Config */ protected $config = []; + /** + * @param array $settings + */ public function __construct($settings = null) { self::$instance = $this; @@ -36,6 +45,9 @@ class Config } } + /** + * @param string $yamlFile + */ public function loadYaml($yamlFile) { // Path to a YAML file. @@ -52,8 +64,10 @@ class Config /** * Get a configuration value by key, returning a default value if not set. - * @param $key string - * @param $default mixed + * + * @param string $key + * @param mixed $default + * * @return mixed */ public function get($key, $default = null) @@ -82,9 +96,10 @@ class Config /** * Set a value by key. - * @param $key string - * @param $value mixed - * + * + * @param string $key + * @param mixed $value + * * @return boolean */ public function set($key, $value = null) @@ -96,6 +111,8 @@ class Config /** * Set an array of values. + * + * @param $array */ public function setArray($array) { @@ -105,6 +122,10 @@ class Config /** * Short-hand syntax for get() * @see Config::get() + * + * @param string $key + * + * @return mixed */ public function __get($key) { @@ -114,6 +135,11 @@ class Config /** * Short-hand syntax for set() * @see Config::set() + * + * @param string $key + * @param mixed $value + * + * @return bool */ public function __set($key, $value = null) { @@ -122,6 +148,10 @@ class Config /** * Is set + * + * @param string $key + * + * @return boolean */ public function __isset($key) { @@ -130,6 +160,8 @@ class Config /** * Unset + * + * @param string $key */ public function __unset($key) { @@ -137,8 +169,8 @@ class Config } /** - * Deeply merge the $target array onto the $source array. - * The $source array will be modified! + * Deeply merge the $target array onto the $source array. The $source array will be modified! + * * @param array $source * @param array $target */ @@ -153,7 +185,6 @@ class Config if (!is_array($source[$target_key]) && !is_array($target_value)) { // Neither value is an array, overwrite $source[$target_key] = $target_value; - } elseif (is_array($source[$target_key]) && is_array($target_value)) { // Both are arrays, deep merge them self::deepMerge($source[$target_key], $target_value); @@ -173,6 +204,9 @@ class Config } } + /** + * @return array + */ public function getArray() { return $this->config; diff --git a/src/B8Framework/Controller.php b/src/B8Framework/Controller.php index 03bbf47e..325271b8 100644 --- a/src/B8Framework/Controller.php +++ b/src/B8Framework/Controller.php @@ -4,12 +4,7 @@ namespace b8; use b8\Http\Request; use b8\Http\Response; -use b8\View; -/** - * b8 Abstract Controller class - * @package b8 - */ abstract class Controller { /** @@ -37,6 +32,11 @@ abstract class Controller */ protected $view; + /** + * @param Config $config + * @param Request $request + * @param Response $response + */ public function __construct(Config $config, Request $request, Response $response) { $this->config = $config; @@ -44,6 +44,11 @@ abstract class Controller $this->response = $response; } + /** + * @param string $name + * + * @return boolean + */ public function hasAction($name) { if (method_exists($this, $name)) { @@ -59,6 +64,10 @@ abstract class Controller /** * Handles an action on this controller and returns a Response object. + * + * @param string $action + * @param array $actionParams + * * @return Response */ public function handleAction($action, $actionParams) @@ -84,8 +93,8 @@ abstract class Controller /** * Get a specific incoming request parameter. * - * @param $key - * @param mixed $default Default return value (if key does not exist) + * @param string $key + * @param mixed $default Default return value (if key does not exist) * * @return mixed */ @@ -96,20 +105,22 @@ abstract class Controller /** * Change the value of an incoming request parameter. - * @param $key - * @param $value + * + * @param string $key + * @param mixed $value */ public function setParam($key, $value) { - return $this->request->setParam($key, $value); + $this->request->setParam($key, $value); } /** * Remove an incoming request parameter. - * @param $key + * + * @param string $key */ public function unsetParam($key) { - return $this->request->unsetParam($key); + $this->request->unsetParam($key); } } diff --git a/src/B8Framework/Database.php b/src/B8Framework/Database.php index 7c6903d8..9cddd471 100644 --- a/src/B8Framework/Database.php +++ b/src/B8Framework/Database.php @@ -43,7 +43,7 @@ class Database extends \PDO * @param string $type * * @return \b8\Database - * + * * @throws \Exception */ public static function getConnection($type = 'read') diff --git a/src/B8Framework/Exception/HttpException.php b/src/B8Framework/Exception/HttpException.php index 21aae3fd..4c266213 100644 --- a/src/B8Framework/Exception/HttpException.php +++ b/src/B8Framework/Exception/HttpException.php @@ -4,19 +4,35 @@ namespace b8\Exception; class HttpException extends \Exception { - protected $errorCode = 500; + /** + * @var integer + */ + protected $errorCode = 500; + + /** + * @var string + */ protected $statusMessage = 'Internal Server Error'; + /** + * @return integer + */ public function getErrorCode() { return $this->errorCode; } + /** + * @return string + */ public function getStatusMessage() { return $this->statusMessage; } + /** + * @return string + */ public function getHttpHeader() { return 'HTTP/1.1 ' . $this->errorCode . ' ' . $this->statusMessage; diff --git a/src/B8Framework/Exception/HttpException/BadRequestException.php b/src/B8Framework/Exception/HttpException/BadRequestException.php index 3e9c2f7e..ec30b8e5 100644 --- a/src/B8Framework/Exception/HttpException/BadRequestException.php +++ b/src/B8Framework/Exception/HttpException/BadRequestException.php @@ -6,6 +6,13 @@ use b8\Exception\HttpException; class BadRequestException extends HttpException { - protected $errorCode = 400; + /** + * @var integer + */ + protected $errorCode = 400; + + /** + * @var string + */ protected $statusMessage = 'Bad Request'; } diff --git a/src/B8Framework/Exception/HttpException/ForbiddenException.php b/src/B8Framework/Exception/HttpException/ForbiddenException.php index 9b0df329..1fe357da 100644 --- a/src/B8Framework/Exception/HttpException/ForbiddenException.php +++ b/src/B8Framework/Exception/HttpException/ForbiddenException.php @@ -6,6 +6,13 @@ use b8\Exception\HttpException; class ForbiddenException extends HttpException { - protected $errorCode = 403; + /** + * @var integer + */ + protected $errorCode = 403; + + /** + * @var string + */ protected $statusMessage = 'Forbidden'; } diff --git a/src/B8Framework/Exception/HttpException/NotAuthorizedException.php b/src/B8Framework/Exception/HttpException/NotAuthorizedException.php index 54ed2877..f1e44586 100644 --- a/src/B8Framework/Exception/HttpException/NotAuthorizedException.php +++ b/src/B8Framework/Exception/HttpException/NotAuthorizedException.php @@ -6,6 +6,13 @@ use b8\Exception\HttpException; class NotAuthorizedException extends HttpException { - protected $errorCode = 401; + /** + * @var integer + */ + protected $errorCode = 401; + + /** + * @var string + */ protected $statusMessage = 'Not Authorized'; } diff --git a/src/B8Framework/Exception/HttpException/NotFoundException.php b/src/B8Framework/Exception/HttpException/NotFoundException.php index 26533b9f..883d74a7 100644 --- a/src/B8Framework/Exception/HttpException/NotFoundException.php +++ b/src/B8Framework/Exception/HttpException/NotFoundException.php @@ -6,6 +6,13 @@ use b8\Exception\HttpException; class NotFoundException extends HttpException { - protected $errorCode = 404; + /** + * @var integer + */ + protected $errorCode = 404; + + /** + * @var string + */ protected $statusMessage = 'Not Found'; } diff --git a/src/B8Framework/Exception/HttpException/ValidationException.php b/src/B8Framework/Exception/HttpException/ValidationException.php index 166eb745..4714e5c0 100644 --- a/src/B8Framework/Exception/HttpException/ValidationException.php +++ b/src/B8Framework/Exception/HttpException/ValidationException.php @@ -6,6 +6,13 @@ use b8\Exception\HttpException; class ValidationException extends HttpException { - protected $errorCode = 400; + /** + * @var integer + */ + protected $errorCode = 400; + + /** + * @var string + */ protected $statusMessage = 'Bad Request'; } diff --git a/src/B8Framework/Form.php b/src/B8Framework/Form.php index 941bc857..664f8583 100644 --- a/src/B8Framework/Form.php +++ b/src/B8Framework/Form.php @@ -2,33 +2,55 @@ namespace b8; -use b8\Form\FieldSet, b8\View; +use b8\Form\FieldSet; class Form extends FieldSet { + /** + * @var string + */ protected $_action = ''; + + /** + * @var string + */ protected $_method = 'POST'; + /** + * @return string + */ public function getAction() { return $this->_action; } + /** + * @param string $action + */ public function setAction($action) { $this->_action = $action; } + /** + * @return string + */ public function getMethod() { return $this->_method; } + /** + * @param string $method + */ public function setMethod($method) { $this->_method = $method; } + /** + * @param View $view + */ protected function onPreRender(View &$view) { $view->action = $this->getAction(); @@ -37,6 +59,9 @@ class Form extends FieldSet parent::onPreRender($view); } + /** + * @return string + */ public function __toString() { return $this->render(); diff --git a/src/B8Framework/Form/Element.php b/src/B8Framework/Form/Element.php index 8cd6a43b..cea9ff39 100644 --- a/src/B8Framework/Form/Element.php +++ b/src/B8Framework/Form/Element.php @@ -7,13 +7,39 @@ use b8\Config; abstract class Element { + /** + * @var string + */ protected $_name; + + /** + * @var string + */ protected $_id; + + /** + * @var string + */ protected $_label; + + /** + * @var string + */ protected $_css; + + /** + * @var string + */ protected $_ccss; + + /** + * @var Element + */ protected $_parent; + /** + * @param string|null $name + */ public function __construct($name = null) { if (!is_null($name)) { @@ -21,73 +47,123 @@ abstract class Element } } + /** + * @return string + */ public function getName() { return $this->_name; } + /** + * @param string $name + * + * @return $this + */ public function setName($name) { $this->_name = strtolower(preg_replace('/([^a-zA-Z0-9_\-%])/', '', $name)); return $this; } + /** + * @return string + */ public function getId() { return !$this->_id ? 'element-' . $this->_name : $this->_id; } + /** + * @param string $id + * + * @return $this + */ public function setId($id) { $this->_id = $id; return $this; } + /** + * @return string + */ public function getLabel() { return $this->_label; } + /** + * @param string $label + * + * @return $this + */ public function setLabel($label) { $this->_label = $label; return $this; } + /** + * @return string + */ public function getClass() { return $this->_css; } + /** + * @param string $class + * + * @return $this + */ public function setClass($class) { $this->_css = $class; return $this; } + /** + * @return string + */ public function getContainerClass() { return $this->_ccss; } + /** + * @param string $class + * + * @return $this + */ public function setContainerClass($class) { $this->_ccss = $class; return $this; } + /** + * @param Element $parent + * + * @return $this + */ public function setParent(Element $parent) { $this->_parent = $parent; return $this; } + /** + * @param string $viewFile + * + * @return string + */ public function render($viewFile = null) { $viewPath = Config::getInstance()->get('b8.view.path'); if (is_null($viewFile)) { - $class = explode('\\', get_called_class()); + $class = explode('\\', get_called_class()); $viewFile = end($class); } @@ -109,5 +185,8 @@ abstract class Element return $view->render(); } + /** + * @param View $view + */ abstract protected function onPreRender(View &$view); } diff --git a/src/B8Framework/Form/Element/Button.php b/src/B8Framework/Form/Element/Button.php index 26110100..7f6948a4 100644 --- a/src/B8Framework/Form/Element/Button.php +++ b/src/B8Framework/Form/Element/Button.php @@ -2,18 +2,26 @@ namespace b8\Form\Element; -use b8\Form\Input, b8\View; +use b8\Form\Input; +use b8\View; class Button extends Input { + /** + * @return boolean + */ public function validate() { return true; } + /** + * @param View $view + */ protected function onPreRender(View &$view) { parent::onPreRender($view); + $view->type = 'button'; } } diff --git a/src/B8Framework/Form/Element/Checkbox.php b/src/B8Framework/Form/Element/Checkbox.php index dd7b7108..482b7b7a 100644 --- a/src/B8Framework/Form/Element/Checkbox.php +++ b/src/B8Framework/Form/Element/Checkbox.php @@ -2,23 +2,40 @@ namespace b8\Form\Element; -use b8\View, b8\Form\Input; +use b8\View; +use b8\Form\Input; class Checkbox extends Input { + /** + * @var boolean + */ protected $_checked; + + /** + * @var mixed + */ protected $_checkedValue; + /** + * @return mixed + */ public function getCheckedValue() { return $this->_checkedValue; } + /** + * @param mixed $value + */ public function setCheckedValue($value) { $this->_checkedValue = $value; } + /** + * @param mixed $value + */ public function setValue($value) { if (is_bool($value) && $value === true) { @@ -33,13 +50,17 @@ class Checkbox extends Input return; } - $this->_value = $value; + $this->_value = $value; $this->_checked = false; } + /** + * @param View $view + */ public function onPreRender(View &$view) { parent::onPreRender($view); + $view->checkedValue = $this->getCheckedValue(); $view->checked = $this->_checked; } diff --git a/src/B8Framework/Form/Element/Csrf.php b/src/B8Framework/Form/Element/Csrf.php index 3df0c247..caeb18dd 100644 --- a/src/B8Framework/Form/Element/Csrf.php +++ b/src/B8Framework/Form/Element/Csrf.php @@ -6,8 +6,14 @@ use b8\View; class Csrf extends Hidden { + /** + * @var integer + */ protected $_rows = 4; + /** + * @return boolean + */ public function validate() { if ($this->_value != $_COOKIE[$this->getName()]) { @@ -17,11 +23,16 @@ class Csrf extends Hidden return true; } + /** + * @param View $view + */ protected function onPreRender(View &$view) { parent::onPreRender($view); - $csrf = md5(microtime(true)); + + $csrf = md5(microtime(true)); $view->csrf = $csrf; + setcookie($this->getName(), $csrf); } } diff --git a/src/B8Framework/Form/Element/Email.php b/src/B8Framework/Form/Element/Email.php index 7726a2b9..ccf10965 100644 --- a/src/B8Framework/Form/Element/Email.php +++ b/src/B8Framework/Form/Element/Email.php @@ -6,14 +6,23 @@ use b8\View; class Email extends Text { + /** + * @param string $viewFile + * + * @return string + */ public function render($viewFile = null) { return parent::render(($viewFile ? $viewFile : 'Text')); } + /** + * @param View $view + */ protected function onPreRender(View &$view) { parent::onPreRender($view); + $view->type = 'email'; } } diff --git a/src/B8Framework/Form/Element/Password.php b/src/B8Framework/Form/Element/Password.php index 258ec873..6701a753 100644 --- a/src/B8Framework/Form/Element/Password.php +++ b/src/B8Framework/Form/Element/Password.php @@ -6,14 +6,23 @@ use b8\View; class Password extends Text { + /** + * @param string $viewFile + * + * @return string + */ public function render($viewFile = null) { return parent::render(($viewFile ? $viewFile : 'Text')); } + /** + * @param View $view + */ protected function onPreRender(View &$view) { parent::onPreRender($view); + $view->type = 'password'; } } diff --git a/src/B8Framework/Form/Element/Select.php b/src/B8Framework/Form/Element/Select.php index 7119c637..d48060b9 100644 --- a/src/B8Framework/Form/Element/Select.php +++ b/src/B8Framework/Form/Element/Select.php @@ -2,20 +2,31 @@ namespace b8\Form\Element; -use b8\View, b8\Form\Input; +use b8\View; +use b8\Form\Input; class Select extends Input { + /** + * @var array + */ protected $_options = []; + /** + * @param array $options + */ public function setOptions(array $options) { $this->_options = $options; } + /** + * @param View $view + */ protected function onPreRender(View &$view) { parent::onPreRender($view); + $view->options = $this->_options; } } diff --git a/src/B8Framework/Form/Element/Submit.php b/src/B8Framework/Form/Element/Submit.php index 5d0cbfdb..7493531a 100644 --- a/src/B8Framework/Form/Element/Submit.php +++ b/src/B8Framework/Form/Element/Submit.php @@ -6,16 +6,28 @@ use b8\View; class Submit extends Button { + /** + * @var string + */ protected $_value = 'Submit'; + /** + * @param string $viewFile + * + * @return string + */ public function render($viewFile = null) { return parent::render(($viewFile ? $viewFile : 'Button')); } + /** + * @param View $view + */ protected function onPreRender(View &$view) { parent::onPreRender($view); + $view->type = 'submit'; } } diff --git a/src/B8Framework/Form/Element/Text.php b/src/B8Framework/Form/Element/Text.php index 6aa04ba6..56c88ca7 100644 --- a/src/B8Framework/Form/Element/Text.php +++ b/src/B8Framework/Form/Element/Text.php @@ -2,13 +2,18 @@ namespace b8\Form\Element; -use b8\Form\Input, b8\View; +use b8\Form\Input; +use b8\View; class Text extends Input { + /** + * @param View $view + */ protected function onPreRender(View &$view) { parent::onPreRender($view); + $view->type = 'text'; } } diff --git a/src/B8Framework/Form/Element/TextArea.php b/src/B8Framework/Form/Element/TextArea.php index 14f54e1f..5744b653 100644 --- a/src/B8Framework/Form/Element/TextArea.php +++ b/src/B8Framework/Form/Element/TextArea.php @@ -6,21 +6,34 @@ use b8\View; class TextArea extends Text { + /** + * @var integer + */ protected $_rows = 4; + /** + * @return integer + */ public function getRows() { return $this->_rows; } + /** + * @param integer $rows + */ public function setRows($rows) { $this->_rows = $rows; } + /** + * @param View $view + */ protected function onPreRender(View &$view) { parent::onPreRender($view); + $view->rows = $this->getRows(); } } diff --git a/src/B8Framework/Form/Element/Url.php b/src/B8Framework/Form/Element/Url.php index 1f5580e8..4627eb79 100644 --- a/src/B8Framework/Form/Element/Url.php +++ b/src/B8Framework/Form/Element/Url.php @@ -6,14 +6,23 @@ use b8\View; class Url extends Text { + /** + * @param string $viewFile + * + * @return string + */ public function render($viewFile = null) { return parent::render(($viewFile ? $viewFile : 'Text')); } + /** + * @param View $view + */ protected function onPreRender(View &$view) { parent::onPreRender($view); + $view->type = 'url'; } } diff --git a/src/B8Framework/Form/FieldSet.php b/src/B8Framework/Form/FieldSet.php index fefc5915..94b63f5e 100644 --- a/src/B8Framework/Form/FieldSet.php +++ b/src/B8Framework/Form/FieldSet.php @@ -2,12 +2,18 @@ namespace b8\Form; -use b8\Form\Element, b8\View; +use b8\View; class FieldSet extends Element { + /** + * @var Element[] + */ protected $_children = []; + /** + * @return array + */ public function getValues() { $rtn = []; @@ -30,6 +36,9 @@ class FieldSet extends Element return $rtn; } + /** + * @param array $values + */ public function setValues(array $values) { foreach ($this->_children as $field) { @@ -51,12 +60,18 @@ class FieldSet extends Element } } + /** + * @param Element $field + */ public function addField(Element $field) { $this->_children[$field->getName()] = $field; $field->setParent($this); } + /** + * @return boolean + */ public function validate() { $rtn = true; @@ -70,6 +85,9 @@ class FieldSet extends Element return $rtn; } + /** + * @param View $view + */ protected function onPreRender(View &$view) { $rendered = []; @@ -80,11 +98,19 @@ class FieldSet extends Element $view->children = $rendered; } + /** + * @return Element[] + */ public function getChildren() { return $this->_children; } + /** + * @param string $fieldName + * + * @return Element + */ public function getChild($fieldName) { return $this->_children[$fieldName]; diff --git a/src/B8Framework/Form/Input.php b/src/B8Framework/Form/Input.php index 46c20043..5b0bafad 100644 --- a/src/B8Framework/Form/Input.php +++ b/src/B8Framework/Form/Input.php @@ -2,17 +2,47 @@ namespace b8\Form; -use b8\Form\Element, b8\View; +use b8\View; class Input extends Element { + /** + * @var boolean + */ protected $_required = false; + + /** + * @var string + */ protected $_pattern; + + /** + * @var callable + */ protected $_validator; + + /** + * @var mixed + */ protected $_value; + + /** + * @var string + */ protected $_error; + + /** + * @var boolean + */ protected $_customError = false; + /** + * @param string $name + * @param string $label + * @param boolean $required + * + * @return static + */ public static function create($name, $label, $required = false) { $el = new static(); @@ -23,33 +53,59 @@ class Input extends Element return $el; } + /** + * @return mixed + */ public function getValue() { return $this->_value; } + /** + * @param mixed $value + * + * @return $this + */ public function setValue($value) { $this->_value = $value; + return $this; } + /** + * @return boolean + */ public function getRequired() { return $this->_required; } + /** + * @param boolean $required + * + * @return $this + */ public function setRequired($required) { $this->_required = (bool)$required; + return $this; } + /** + * @return callable + */ public function getValidator() { return $this->_validator; } + /** + * @param callable $validator + * + * @return $this + */ public function setValidator($validator) { if (is_callable($validator) || $validator instanceof \Closure) { @@ -59,17 +115,29 @@ class Input extends Element return $this; } + /** + * @return string + */ public function getPattern() { return $this->_pattern; } + /** + * @param string $pattern + * + * @return $this + */ public function setPattern($pattern) { $this->_pattern = $pattern; + return $this; } + /** + * @return boolean + */ public function validate() { if ($this->getRequired() && empty($this->_value)) { @@ -79,6 +147,7 @@ class Input extends Element if ($this->getPattern() && !preg_match('/' . $this->getPattern() . '/', $this->_value)) { $this->_error = 'Invalid value entered.'; + return false; } @@ -89,6 +158,7 @@ class Input extends Element call_user_func_array($validator, [$this->_value]); } catch (\Exception $ex) { $this->_error = $ex->getMessage(); + return false; } } @@ -100,18 +170,27 @@ class Input extends Element return true; } + /** + * @param string $message + * + * @return $this + */ public function setError($message) { $this->_customError = true; - $this->_error = $message; + $this->_error = $message; + return $this; } + /** + * @param View $view + */ protected function onPreRender(View &$view) { - $view->value = $this->getValue(); - $view->error = $this->_error; - $view->pattern = $this->_pattern; + $view->value = $this->getValue(); + $view->error = $this->_error; + $view->pattern = $this->_pattern; $view->required = $this->_required; } } diff --git a/src/B8Framework/Form/View/Button.phtml b/src/B8Framework/Form/View/Button.phtml index ccce383c..60a3a613 100644 --- a/src/B8Framework/Form/View/Button.phtml +++ b/src/B8Framework/Form/View/Button.phtml @@ -1 +1 @@ - + diff --git a/src/B8Framework/Form/View/Checkbox.phtml b/src/B8Framework/Form/View/Checkbox.phtml index 3c875490..c4a0858a 100644 --- a/src/B8Framework/Form/View/Checkbox.phtml +++ b/src/B8Framework/Form/View/Checkbox.phtml @@ -1,15 +1,17 @@ -
+
-
diff --git a/src/B8Framework/Form/View/CheckboxGroup.phtml b/src/B8Framework/Form/View/CheckboxGroup.phtml index 4b97193a..53b8b22d 100644 --- a/src/B8Framework/Form/View/CheckboxGroup.phtml +++ b/src/B8Framework/Form/View/CheckboxGroup.phtml @@ -1,11 +1,11 @@ -
+
- +
- +
diff --git a/src/B8Framework/Form/View/ControlGroup.phtml b/src/B8Framework/Form/View/ControlGroup.phtml index 1eeaace7..07ef0713 100644 --- a/src/B8Framework/Form/View/ControlGroup.phtml +++ b/src/B8Framework/Form/View/ControlGroup.phtml @@ -1,5 +1,5 @@ -
+
- +
diff --git a/src/B8Framework/Form/View/Csrf.phtml b/src/B8Framework/Form/View/Csrf.phtml index 52461951..3068e4f6 100644 --- a/src/B8Framework/Form/View/Csrf.phtml +++ b/src/B8Framework/Form/View/Csrf.phtml @@ -1 +1 @@ - + diff --git a/src/B8Framework/Form/View/FieldSet.phtml b/src/B8Framework/Form/View/FieldSet.phtml index debd66d7..96b8590d 100644 --- a/src/B8Framework/Form/View/FieldSet.phtml +++ b/src/B8Framework/Form/View/FieldSet.phtml @@ -1,9 +1,9 @@ -
+
- + - +
diff --git a/src/B8Framework/Form/View/Form.phtml b/src/B8Framework/Form/View/Form.phtml index fbbbe31a..d79db842 100644 --- a/src/B8Framework/Form/View/Form.phtml +++ b/src/B8Framework/Form/View/Form.phtml @@ -1,5 +1,5 @@ -
+ - +
diff --git a/src/B8Framework/Form/View/Hidden.phtml b/src/B8Framework/Form/View/Hidden.phtml index 9395fd54..ae27cc6a 100644 --- a/src/B8Framework/Form/View/Hidden.phtml +++ b/src/B8Framework/Form/View/Hidden.phtml @@ -1 +1 @@ - + diff --git a/src/B8Framework/Form/View/Radio.phtml b/src/B8Framework/Form/View/Radio.phtml index 4e66573b..2ce02782 100644 --- a/src/B8Framework/Form/View/Radio.phtml +++ b/src/B8Framework/Form/View/Radio.phtml @@ -1,19 +1,21 @@ -
+
- +
$lbl): ?> -
diff --git a/src/B8Framework/Form/View/Select.phtml b/src/B8Framework/Form/View/Select.phtml index 68224377..850795f4 100644 --- a/src/B8Framework/Form/View/Select.phtml +++ b/src/B8Framework/Form/View/Select.phtml @@ -1,18 +1,19 @@ -
+
- +
- $lbl): ?> + value="" + > - +
diff --git a/src/B8Framework/Form/View/Text.phtml b/src/B8Framework/Form/View/Text.phtml index 37deba14..231e6557 100644 --- a/src/B8Framework/Form/View/Text.phtml +++ b/src/B8Framework/Form/View/Text.phtml @@ -1,14 +1,17 @@ -
+
- +
- > - + + + + > - +
diff --git a/src/B8Framework/Form/View/TextArea.phtml b/src/B8Framework/Form/View/TextArea.phtml index b9a3660e..26b782b4 100644 --- a/src/B8Framework/Form/View/TextArea.phtml +++ b/src/B8Framework/Form/View/TextArea.phtml @@ -1,13 +1,13 @@ -
+
- +
- + - +
diff --git a/src/B8Framework/Model.php b/src/B8Framework/Model.php index 929a8ed3..34fa0b19 100644 --- a/src/B8Framework/Model.php +++ b/src/B8Framework/Model.php @@ -3,7 +3,6 @@ namespace b8; use b8\Exception\HttpException; -use b8\Cache; class Model { diff --git a/src/B8Framework/Store.php b/src/B8Framework/Store.php index bf6b5282..2c295799 100644 --- a/src/B8Framework/Store.php +++ b/src/B8Framework/Store.php @@ -3,19 +3,45 @@ namespace b8; use b8\Exception\HttpException; -use b8\Database; abstract class Store { - protected $modelName = null; - protected $tableName = null; + /** + * @var string + */ + protected $modelName = null; + + /** + * @var string + */ + protected $tableName = null; + + /** + * @var string + */ protected $primaryKey = null; /** - * @return \b8\Model + * @param string $key + * @param string $useConnection + * + * @return Model */ abstract public function getByPrimaryKey($key, $useConnection = 'read'); + /** + * @param array $where + * @param integer $limit + * @param integer $offset + * @param array $joins + * @param array $order + * @param array $manualJoins + * @param string $group + * @param array $manualWheres + * @param string $whereType + * + * @return array + */ public function getWhere( $where = [], $limit = 25, @@ -196,6 +222,14 @@ abstract class Store } } + /** + * @param Model $obj + * @param boolean $saveAllColumns + * + * @throws HttpException\BadRequestException + * + * @return Model|null + */ public function save(Model $obj, $saveAllColumns = false) { if (!isset($this->primaryKey)) { @@ -217,6 +251,12 @@ abstract class Store return $rtn; } + /** + * @param Model $obj + * @param bool $saveAllColumns + * + * @return Model|null + */ public function saveByUpdate(Model $obj, $saveAllColumns = false) { $rtn = null; @@ -249,6 +289,12 @@ abstract class Store return $rtn; } + /** + * @param Model $obj + * @param bool $saveAllColumns + * + * @return Model|null + */ public function saveByInsert(Model $obj, $saveAllColumns = false) { $rtn = null; @@ -280,6 +326,13 @@ abstract class Store return $rtn; } + /** + * @param Model $obj + * + * @throws HttpException\BadRequestException + * + * @return boolean + */ public function delete(Model $obj) { if (!isset($this->primaryKey)) { @@ -299,6 +352,13 @@ abstract class Store return true; } + /** + * @param string $field + * + * @throws HttpException + * + * @return string + */ protected function fieldCheck($field) { if (empty($field)) { diff --git a/src/PHPCensor/Application.php b/src/PHPCensor/Application.php index 1e69eb56..0c2af77d 100644 --- a/src/PHPCensor/Application.php +++ b/src/PHPCensor/Application.php @@ -108,8 +108,10 @@ class Application extends b8\Application /** * Loads a particular controller, and injects our layout view into it. - * @param $class - * @return mixed + * + * @param string $class + * + * @return b8\Controller */ protected function loadController($class) { @@ -123,6 +125,7 @@ class Application extends b8\Application /** * Injects variables into the layout before rendering it. + * * @param View $layout */ protected function setLayoutVariables(View &$layout) @@ -145,8 +148,8 @@ class Application extends b8\Application /** * Check whether we should skip auth (because it is disabled) - * - * @return bool + * + * @return boolean */ protected function shouldSkipAuth() { diff --git a/src/PHPCensor/BuildFactory.php b/src/PHPCensor/BuildFactory.php index 71393729..95690732 100644 --- a/src/PHPCensor/BuildFactory.php +++ b/src/PHPCensor/BuildFactory.php @@ -14,8 +14,10 @@ class BuildFactory { /** * @param $buildId - * @return Build + * * @throws \Exception + * + * @return Build */ public static function getBuildById($buildId) { @@ -29,10 +31,12 @@ class BuildFactory } /** - * Takes a generic build and returns a type-specific build model. - * @param Build $build The build from which to get a more specific build type. - * @return Build - */ + * Takes a generic build and returns a type-specific build model. + * + * @param Build $build The build from which to get a more specific build type. + * + * @return Build + */ public static function getBuild(Build $build) { $project = $build->getProject(); diff --git a/src/PHPCensor/Builder.php b/src/PHPCensor/Builder.php index 09fe5233..20ec48bd 100644 --- a/src/PHPCensor/Builder.php +++ b/src/PHPCensor/Builder.php @@ -123,7 +123,9 @@ class Builder implements LoggerAwareInterface /** * Set the config array, as read from .php-censor.yml - * @param array|null $config + * + * @param array $config + * * @throws \Exception */ public function setConfigArray($config) @@ -138,7 +140,9 @@ class Builder implements LoggerAwareInterface /** * Access a variable from the .php-censor.yml file. - * @param string + * + * @param string $key + * * @return mixed */ public function getConfig($key) @@ -154,7 +158,9 @@ class Builder implements LoggerAwareInterface /** * Access a variable from the config.yml - * @param $key + * + * @param string $key + * * @return mixed */ public function getSystemConfig($key) @@ -163,7 +169,7 @@ class Builder implements LoggerAwareInterface } /** - * @return string The title of the project being built. + * @return string The title of the project being built. */ public function getBuildProjectTitle() { @@ -271,6 +277,8 @@ class Builder implements LoggerAwareInterface /** * Used by this class, and plugins, to execute shell commands. + * + * @return boolean */ public function executeCommand() { @@ -279,6 +287,8 @@ class Builder implements LoggerAwareInterface /** * Returns the output from the last command run. + * + * @return string */ public function getLastOutput() { @@ -287,7 +297,8 @@ class Builder implements LoggerAwareInterface /** * Specify whether exec output should be logged. - * @param bool $enableLog + * + * @param boolean $enableLog */ public function logExecOutput($enableLog = true) { @@ -313,7 +324,9 @@ class Builder implements LoggerAwareInterface /** * Replace every occurrence of the interpolation vars in the given string * Example: "This is build %PHPCI_BUILD%" => "This is build 182" + * * @param string $input + * * @return string */ public function interpolate($input) @@ -323,6 +336,10 @@ class Builder implements LoggerAwareInterface /** * Set up a working copy of the project for building. + * + * @throws \Exception + * + * @return boolean */ protected function setupBuild() { @@ -360,7 +377,6 @@ class Builder implements LoggerAwareInterface * Sets a logger instance on the object * * @param LoggerInterface $logger - * @return null */ public function setLogger(LoggerInterface $logger) { @@ -369,9 +385,10 @@ class Builder implements LoggerAwareInterface /** * Write to the build log. - * @param $message + * + * @param string $message * @param string $level - * @param array $context + * @param array $context */ public function log($message, $level = LogLevel::INFO, $context = []) { @@ -391,7 +408,7 @@ class Builder implements LoggerAwareInterface /** * Add a failure-coloured message to the log. * - * @param string $message + * @param string $message * @param \Exception $exception The exception that caused the error. */ public function logFailure($message, \Exception $exception = null) @@ -413,6 +430,7 @@ class Builder implements LoggerAwareInterface * Returns a configured instance of the plugin factory. * * @param Build $build + * * @return PluginFactory */ private function buildPluginFactory(Build $build) diff --git a/src/PHPCensor/BuilderException.php b/src/PHPCensor/BuilderException.php index 04dedccd..67a05b97 100644 --- a/src/PHPCensor/BuilderException.php +++ b/src/PHPCensor/BuilderException.php @@ -2,7 +2,8 @@ namespace PHPCensor; -class BuilderException extends \Exception { +class BuilderException extends \Exception +{ /** Fail start build - non fatal */ const FAIL_START = 1; } diff --git a/src/PHPCensor/Command/InstallCommand.php b/src/PHPCensor/Command/InstallCommand.php index a9c589ea..16e2537a 100644 --- a/src/PHPCensor/Command/InstallCommand.php +++ b/src/PHPCensor/Command/InstallCommand.php @@ -105,7 +105,7 @@ class InstallCommand extends Command /** * @param OutputInterface $output - * + * * @return bool */ protected function verifyNotInstalled(OutputInterface $output) @@ -126,7 +126,7 @@ class InstallCommand extends Command * Check PHP version, required modules and for disabled functions. * * @param OutputInterface $output - * + * * @throws \Exception */ protected function checkRequirements(OutputInterface $output) @@ -222,7 +222,7 @@ class InstallCommand extends Command * * @param InputInterface $input * @param OutputInterface $output - * + * * @return array */ protected function getConfigInformation(InputInterface $input, OutputInterface $output) @@ -306,10 +306,10 @@ class InstallCommand extends Command /** * If the user wants to use a queue, get the necessary details. - * + * * @param InputInterface $input * @param OutputInterface $output - * + * * @return array */ protected function getQueueInformation(InputInterface $input, OutputInterface $output) @@ -361,7 +361,7 @@ class InstallCommand extends Command * * @param InputInterface $input * @param OutputInterface $output - * + * * @return array */ protected function getDatabaseInformation(InputInterface $input, OutputInterface $output) @@ -427,10 +427,10 @@ class InstallCommand extends Command /** * Try and connect to DB using the details provided - * + * * @param array $db * @param OutputInterface $output - * + * * @return bool */ protected function verifyDatabaseDetails(array $db, OutputInterface $output) diff --git a/src/PHPCensor/Command/RebuildCommand.php b/src/PHPCensor/Command/RebuildCommand.php index 5a8f7445..e62dcab0 100644 --- a/src/PHPCensor/Command/RebuildCommand.php +++ b/src/PHPCensor/Command/RebuildCommand.php @@ -75,7 +75,7 @@ class RebuildCommand extends Command /** * Called when log entries are made in Builder / the plugins. - * + * * @see \PHPCensor\Builder::log() */ public function logCallback($log) diff --git a/src/PHPCensor/Controller.php b/src/PHPCensor/Controller.php index a99ec1f6..e25bd0cf 100644 --- a/src/PHPCensor/Controller.php +++ b/src/PHPCensor/Controller.php @@ -34,8 +34,8 @@ class Controller extends \b8\Controller } /** - * @param Config $config - * @param Request $request + * @param Config $config + * @param Request $request * @param Response $response */ public function __construct(Config $config, Request $request, Response $response) @@ -61,7 +61,8 @@ class Controller extends \b8\Controller /** * Set the view that this controller action should use. - * @param $action + * + * @param string $action */ protected function setView($action) { @@ -72,9 +73,10 @@ class Controller extends \b8\Controller /** * Handle the incoming request. - * @param $action - * @param $actionParams - * + * + * @param string $action + * @param array $actionParams + * * @return Response */ public function handleAction($action, $actionParams) @@ -99,6 +101,7 @@ class Controller extends \b8\Controller /** * Require that the currently logged in user is an administrator. + * * @throws ForbiddenException */ protected function requireAdmin() @@ -110,7 +113,8 @@ class Controller extends \b8\Controller /** * Check if the currently logged in user is an administrator. - * @return bool + * + * @return boolean */ protected function currentUserIsAdmin() { diff --git a/src/PHPCensor/Controller/BuildStatusController.php b/src/PHPCensor/Controller/BuildStatusController.php index 5bb512a1..3dc8fc45 100644 --- a/src/PHPCensor/Controller/BuildStatusController.php +++ b/src/PHPCensor/Controller/BuildStatusController.php @@ -119,7 +119,7 @@ class BuildStatusController extends Controller * Returns the appropriate build status image in SVG format for a given project. * * @param $projectId - * + * * @return b8\Http\Response|b8\Http\Response\RedirectResponse */ public function image($projectId) @@ -175,11 +175,11 @@ class BuildStatusController extends Controller /** * View the public status page of a given project, if enabled. - * + * * @param integer $projectId - * + * * @return string - * + * * @throws \b8\Exception\HttpException\NotFoundException */ public function view($projectId) diff --git a/src/PHPCensor/Controller/ProjectController.php b/src/PHPCensor/Controller/ProjectController.php index 91e94182..c2b0673d 100644 --- a/src/PHPCensor/Controller/ProjectController.php +++ b/src/PHPCensor/Controller/ProjectController.php @@ -76,7 +76,7 @@ class ProjectController extends PHPCensor\Controller /** * View a specific project. - * + * * @param integer $projectId * * @throws NotFoundException @@ -163,7 +163,7 @@ class ProjectController extends PHPCensor\Controller /** * Create a new pending build for a project. - * + * * @param integer $projectId * * @throws NotFoundException diff --git a/src/PHPCensor/Controller/WebhookController.php b/src/PHPCensor/Controller/WebhookController.php index 542241fc..8b40ad83 100644 --- a/src/PHPCensor/Controller/WebhookController.php +++ b/src/PHPCensor/Controller/WebhookController.php @@ -267,7 +267,7 @@ class WebhookController extends Controller * Called by POSTing to /webhook/git/?branch=&commit= * * @param string $projectId - * + * * @return array */ public function git($projectId) @@ -377,12 +377,12 @@ class WebhookController extends Controller /** * Handle the payload when Github sends a Pull Request webhook. - * + * * @param Project $project * @param array $payload - * + * * @return array - * + * * @throws Exception */ protected function githubPullRequest(Project $project, array $payload) @@ -512,9 +512,9 @@ class WebhookController extends Controller * Called by POSTing to /webhook/svn/?branch=&commit= * * @author Sylvain Lévesque - * + * * @param string $projectId - * + * * @return array */ public function svn($projectId) @@ -530,9 +530,9 @@ class WebhookController extends Controller /** * Called by Gogs Webhooks: - * + * * @param string $projectId - * + * * @return array */ public function gogs($projectId) diff --git a/src/PHPCensor/Helper/BuildInterpolator.php b/src/PHPCensor/Helper/BuildInterpolator.php index 9feb228f..f6458051 100644 --- a/src/PHPCensor/Helper/BuildInterpolator.php +++ b/src/PHPCensor/Helper/BuildInterpolator.php @@ -21,7 +21,7 @@ class BuildInterpolator /** * Sets the variables that will be used for interpolation. - * + * * @param BaseBuild $build * @param string $buildPath * @param string $url diff --git a/src/PHPCensor/Helper/CommandExecutor.php b/src/PHPCensor/Helper/CommandExecutor.php index c6b13d0f..b6166066 100644 --- a/src/PHPCensor/Helper/CommandExecutor.php +++ b/src/PHPCensor/Helper/CommandExecutor.php @@ -26,7 +26,14 @@ class CommandExecutor implements CommandExecutorInterface */ protected $verbose; + /** + * @var array + */ protected $lastOutput; + + /** + * @var string + */ protected $lastError; public $logExecOutput = true; @@ -62,9 +69,9 @@ class CommandExecutor implements CommandExecutorInterface /** * Executes shell commands. - * + * * @param array $args - * + * * @return bool Indicates success */ public function executeCommand($args = []) @@ -161,6 +168,8 @@ class CommandExecutor implements CommandExecutorInterface /** * Returns the output from the last command run. + * + * @return string */ public function getLastOutput() { @@ -169,6 +178,8 @@ class CommandExecutor implements CommandExecutorInterface /** * Returns the stderr output from the last command run. + * + * @return string */ public function getLastError() { diff --git a/src/PHPCensor/Helper/CommandExecutorInterface.php b/src/PHPCensor/Helper/CommandExecutorInterface.php index 1febf3d8..63a47b03 100644 --- a/src/PHPCensor/Helper/CommandExecutorInterface.php +++ b/src/PHPCensor/Helper/CommandExecutorInterface.php @@ -10,12 +10,14 @@ interface CommandExecutorInterface * * @param array $args * - * @return bool Indicates success + * @return boolean Indicates success */ public function executeCommand($args = []); /** * Returns the output from the last command run. + * + * @return string */ public function getLastOutput(); diff --git a/src/PHPCensor/Helper/LoginIsDisabled.php b/src/PHPCensor/Helper/LoginIsDisabled.php index 1420a3eb..70ed3486 100644 --- a/src/PHPCensor/Helper/LoginIsDisabled.php +++ b/src/PHPCensor/Helper/LoginIsDisabled.php @@ -13,10 +13,10 @@ class LoginIsDisabled { /** * Checks if - * + * * @param $method * @param array $params - * + * * @return mixed|null */ public function __call($method, $params = []) diff --git a/src/PHPCensor/Migrations/20150308074509_add_user_providers.php b/src/PHPCensor/Migrations/20150308074509_add_user_providers.php index f9b52012..bae5ef88 100644 --- a/src/PHPCensor/Migrations/20150308074509_add_user_providers.php +++ b/src/PHPCensor/Migrations/20150308074509_add_user_providers.php @@ -4,9 +4,6 @@ use Phinx\Migration\AbstractMigration; class AddUserProviders extends AbstractMigration { - /** - * Migrate Up. - */ public function up() { // Add the provider columns @@ -25,9 +22,6 @@ class AddUserProviders extends AbstractMigration ->save(); } - /** - * Migrate Down. - */ public function down() { // Remove the provider columns diff --git a/src/PHPCensor/Model.php b/src/PHPCensor/Model.php index dab1dc7a..b11c4ada 100644 --- a/src/PHPCensor/Model.php +++ b/src/PHPCensor/Model.php @@ -4,5 +4,4 @@ namespace PHPCensor; abstract class Model extends \b8\Model { - } diff --git a/src/PHPCensor/Model/Build/GithubBuild.php b/src/PHPCensor/Model/Build/GithubBuild.php index d160704a..b592be98 100644 --- a/src/PHPCensor/Model/Build/GithubBuild.php +++ b/src/PHPCensor/Model/Build/GithubBuild.php @@ -117,7 +117,7 @@ class GithubBuild extends RemoteGitBuild /** * Get a parsed version of the commit message, with links to issues and commits. - * + * * @return string */ public function getCommitMessage() @@ -138,7 +138,7 @@ class GithubBuild extends RemoteGitBuild /** * Get a template to use for generating links to files. - * + * * @return string */ public function getFileLinkTemplate() diff --git a/src/PHPCensor/Plugin.php b/src/PHPCensor/Plugin.php index 2ec77339..0bb653bc 100644 --- a/src/PHPCensor/Plugin.php +++ b/src/PHPCensor/Plugin.php @@ -55,8 +55,8 @@ abstract class Plugin /** * Find a binary required by a plugin. * - * @param string $binary - * @param bool $quiet Returns null instead of throwing an exception. + * @param string $binary + * @param boolean $quiet Returns null instead of throwing an exception. * * @return null|string * diff --git a/src/PHPCensor/Plugin/Atoum.php b/src/PHPCensor/Plugin/Atoum.php index 08bebeb3..f62424b4 100644 --- a/src/PHPCensor/Plugin/Atoum.php +++ b/src/PHPCensor/Plugin/Atoum.php @@ -67,7 +67,7 @@ class Atoum extends Plugin /** * Run the Atoum plugin. - * + * * @return bool */ public function execute() diff --git a/src/PHPCensor/Plugin/Email.php b/src/PHPCensor/Plugin/Email.php index e64387b6..c460bb45 100644 --- a/src/PHPCensor/Plugin/Email.php +++ b/src/PHPCensor/Plugin/Email.php @@ -24,7 +24,7 @@ class Email extends Plugin /** * Send a notification mail. - * + * * @return boolean */ public function execute() @@ -77,7 +77,7 @@ class Email extends Plugin * @param string[] $ccList * @param string $subject Email subject * @param string $body Email body - * + * * @return integer */ protected function sendEmail($toAddress, $ccList, $subject, $body) diff --git a/src/PHPCensor/Plugin/Mysql.php b/src/PHPCensor/Plugin/Mysql.php index 0005b27a..a7bfbb22 100644 --- a/src/PHPCensor/Plugin/Mysql.php +++ b/src/PHPCensor/Plugin/Mysql.php @@ -127,10 +127,10 @@ class Mysql extends Plugin /** * Builds the MySQL import command required to import/execute the specified file - * + * * @param string $import_file Path to file, relative to the build root * @param string $database If specified, this database is selected before execution - * + * * @return string */ protected function getImportCommand($import_file, $database = null) diff --git a/src/PHPCensor/Plugin/PhpCpd.php b/src/PHPCensor/Plugin/PhpCpd.php index 46cc052d..4094d164 100644 --- a/src/PHPCensor/Plugin/PhpCpd.php +++ b/src/PHPCensor/Plugin/PhpCpd.php @@ -58,11 +58,11 @@ class PhpCpd extends Plugin implements ZeroConfigPluginInterface /** * Check if this plugin can be executed. - * + * * @param $stage * @param Builder $builder * @param Build $build - * + * * @return bool */ public static function canExecute($stage, Builder $builder, Build $build) @@ -115,11 +115,11 @@ class PhpCpd extends Plugin implements ZeroConfigPluginInterface /** * Process the PHPCPD XML report. - * + * * @param $xmlString - * + * * @return integer - * + * * @throws \Exception */ protected function processReport($xmlString) diff --git a/src/PHPCensor/Plugin/PhpMessDetector.php b/src/PHPCensor/Plugin/PhpMessDetector.php index b7d57c61..30134f29 100644 --- a/src/PHPCensor/Plugin/PhpMessDetector.php +++ b/src/PHPCensor/Plugin/PhpMessDetector.php @@ -127,11 +127,11 @@ class PhpMessDetector extends Plugin implements ZeroConfigPluginInterface /** * Process PHPMD's XML output report. - * + * * @param $xmlString - * + * * @return integer - * + * * @throws \Exception */ protected function processReport($xmlString) diff --git a/src/PHPCensor/Plugin/Shell.php b/src/PHPCensor/Plugin/Shell.php index 2ab11a99..9ae7b1b9 100644 --- a/src/PHPCensor/Plugin/Shell.php +++ b/src/PHPCensor/Plugin/Shell.php @@ -59,7 +59,7 @@ class Shell extends Plugin /** * Runs the shell command. - * + * * @return bool */ public function execute() diff --git a/src/PHPCensor/Plugin/Util/Executor.php b/src/PHPCensor/Plugin/Util/Executor.php index a6f9c35c..c36bf7f3 100644 --- a/src/PHPCensor/Plugin/Util/Executor.php +++ b/src/PHPCensor/Plugin/Util/Executor.php @@ -43,10 +43,10 @@ class Executor /** * Execute a the appropriate set of plugins for a given build stage. - * + * * @param array $config Configuration * @param string $stage - * + * * @return bool */ public function executePlugins($config, $stage) diff --git a/src/PHPCensor/ProcessControl/Factory.php b/src/PHPCensor/ProcessControl/Factory.php index 808077a8..b301e82a 100644 --- a/src/PHPCensor/ProcessControl/Factory.php +++ b/src/PHPCensor/ProcessControl/Factory.php @@ -35,7 +35,7 @@ class Factory * Check PosixProcessControl, WindowsProcessControl and UnixProcessControl, in that order. * * @return ProcessControlInterface - * + * * @throws \Exception */ public static function createProcessControl() diff --git a/src/PHPCensor/ProcessControl/PosixProcessControl.php b/src/PHPCensor/ProcessControl/PosixProcessControl.php index 4db218ec..de99307d 100644 --- a/src/PHPCensor/ProcessControl/PosixProcessControl.php +++ b/src/PHPCensor/ProcessControl/PosixProcessControl.php @@ -10,8 +10,8 @@ namespace PHPCensor\ProcessControl; class PosixProcessControl implements ProcessControlInterface { /** + * @param integer $pid * - * @param int $pid * @return bool */ public function isRunning($pid) diff --git a/src/PHPCensor/ProcessControl/ProcessControlInterface.php b/src/PHPCensor/ProcessControl/ProcessControlInterface.php index 41b965a1..1e587676 100644 --- a/src/PHPCensor/ProcessControl/ProcessControlInterface.php +++ b/src/PHPCensor/ProcessControl/ProcessControlInterface.php @@ -23,7 +23,7 @@ interface ProcessControlInterface * * @param int $pid The process identifier. * @param bool $forcefully Whether to gently (false) or forcefully (true) terminate the process. - * + * * @return boolean */ public function kill($pid, $forcefully = false); diff --git a/src/PHPCensor/ProcessControl/UnixProcessControl.php b/src/PHPCensor/ProcessControl/UnixProcessControl.php index 4e12ced1..c65f8600 100644 --- a/src/PHPCensor/ProcessControl/UnixProcessControl.php +++ b/src/PHPCensor/ProcessControl/UnixProcessControl.php @@ -13,6 +13,7 @@ class UnixProcessControl implements ProcessControlInterface * Check process using the "ps" command. * * @param int $pid + * * @return boolean */ public function isRunning($pid) diff --git a/src/PHPCensor/Security/Authentication/LoginPasswordProviderInterface.php b/src/PHPCensor/Security/Authentication/LoginPasswordProviderInterface.php index f1e1f813..24e98cd8 100644 --- a/src/PHPCensor/Security/Authentication/LoginPasswordProviderInterface.php +++ b/src/PHPCensor/Security/Authentication/LoginPasswordProviderInterface.php @@ -11,12 +11,13 @@ use PHPCensor\Model\User; */ interface LoginPasswordProviderInterface extends UserProviderInterface { - /** Verify if the supplied password matches the user's one. + /** + * Verify if the supplied password matches the user's one. * - * @param User $user + * @param User $user * @param string $password * - * @return bool + * @return boolean */ public function verifyPassword(User $user, $password); } diff --git a/src/PHPCensor/Security/Authentication/Service.php b/src/PHPCensor/Security/Authentication/Service.php index 30bd1dd7..7b5aa0ef 100644 --- a/src/PHPCensor/Security/Authentication/Service.php +++ b/src/PHPCensor/Security/Authentication/Service.php @@ -12,12 +12,12 @@ use b8\Config; class Service { /** - * * @var Service */ static private $instance; - /** Return the service singletion. + /** + * Return the service singleton. * * @return Service */ @@ -43,11 +43,12 @@ class Service return self::$instance; } - /** Create a provider from a given configuration. + /** + * Create a provider from a given configuration. * * @param string $key * @param string|array $config - * + * * @return UserProviderInterface */ public static function buildProvider($key, $config) @@ -60,13 +61,15 @@ class Service return new $class($key, $config); } - /** The table of providers. + /** + * The table of providers. * * @var array */ private $providers; - /** Initialize the service. + /** + * Initialize the service. * * @param array $providers */ @@ -75,7 +78,8 @@ class Service $this->providers = $providers; } - /** Return all providers. + /** + * Return all providers. * * @return UserProviderInterface[] */ @@ -84,7 +88,8 @@ class Service return $this->providers; } - /** Return the user providers that allows password authentication. + /** + * Return the user providers that allows password authentication. * * @return LoginPasswordProviderInterface[] */ diff --git a/src/PHPCensor/Security/Authentication/UserProvider/AbstractProvider.php b/src/PHPCensor/Security/Authentication/UserProvider/AbstractProvider.php index f5c8a618..3aabe3b4 100644 --- a/src/PHPCensor/Security/Authentication/UserProvider/AbstractProvider.php +++ b/src/PHPCensor/Security/Authentication/UserProvider/AbstractProvider.php @@ -23,7 +23,7 @@ abstract class AbstractProvider implements UserProviderInterface /** * AbstractProvider constructor - * + * * @param string $key * @param array $config */ diff --git a/src/PHPCensor/Security/Authentication/UserProvider/Internal.php b/src/PHPCensor/Security/Authentication/UserProvider/Internal.php index b5fe70f2..5c05c1e1 100644 --- a/src/PHPCensor/Security/Authentication/UserProvider/Internal.php +++ b/src/PHPCensor/Security/Authentication/UserProvider/Internal.php @@ -12,6 +12,12 @@ use PHPCensor\Security\Authentication\LoginPasswordProviderInterface; */ class Internal extends AbstractProvider implements LoginPasswordProviderInterface { + /** + * @param User $user + * @param string $password + * + * @return boolean + */ public function verifyPassword(User $user, $password) { return password_verify($password, $user->getHash()); @@ -22,6 +28,11 @@ class Internal extends AbstractProvider implements LoginPasswordProviderInterfac // Always fine } + /** + * @param string $identifier + * + * @return null + */ public function provisionUser($identifier) { return null; diff --git a/src/PHPCensor/Security/Authentication/UserProvider/Ldap.php b/src/PHPCensor/Security/Authentication/UserProvider/Ldap.php index eee5ca3b..6fa3470e 100644 --- a/src/PHPCensor/Security/Authentication/UserProvider/Ldap.php +++ b/src/PHPCensor/Security/Authentication/UserProvider/Ldap.php @@ -15,6 +15,12 @@ use PHPCensor\Store\UserStore; */ class Ldap extends AbstractProvider implements LoginPasswordProviderInterface { + /** + * @param User $user + * @param string $password + * + * @return bool + */ public function verifyPassword(User $user, $password) { if (isset($this->config['data'])) { @@ -59,6 +65,11 @@ class Ldap extends AbstractProvider implements LoginPasswordProviderInterface // Always fine } + /** + * @param string $identifier + * + * @return User + */ public function provisionUser($identifier) { /** @var UserStore $user */ diff --git a/src/PHPCensor/Security/Authentication/UserProviderInterface.php b/src/PHPCensor/Security/Authentication/UserProviderInterface.php index 38b0da26..148d6c67 100644 --- a/src/PHPCensor/Security/Authentication/UserProviderInterface.php +++ b/src/PHPCensor/Security/Authentication/UserProviderInterface.php @@ -12,13 +12,15 @@ use PHPCensor\Model\User; interface UserProviderInterface { - /** Check if all software requirements are met (libraries, extensions, ...) + /** + * Check if all software requirements are met (libraries, extensions, ...) * * @throws \Exception */ public function checkRequirements(); - /** Provision an new user for the given identifier. + /** + * Provision an new user for the given identifier. * * @param string $identifier The user identifier. * diff --git a/src/PHPCensor/Service/BuildService.php b/src/PHPCensor/Service/BuildService.php index 169b834d..6ebffa46 100644 --- a/src/PHPCensor/Service/BuildService.php +++ b/src/PHPCensor/Service/BuildService.php @@ -21,7 +21,7 @@ class BuildService protected $buildStore; /** - * @var bool + * @var boolean */ public $queueError = false; @@ -44,7 +44,7 @@ class BuildService * @param integer $source * @param integer $userId * @param string|null $extra - * + * * @return \PHPCensor\Model\Build */ public function createBuild( @@ -109,6 +109,7 @@ class BuildService /** * @param Build $copyFrom + * * @return \PHPCensor\Model\Build */ public function createDuplicateBuild(Build $copyFrom) @@ -143,8 +144,10 @@ class BuildService /** * Delete a given build. + * * @param Build $build - * @return bool + * + * @return boolean */ public function deleteBuild(Build $build) { diff --git a/src/PHPCensor/Service/BuildStatusService.php b/src/PHPCensor/Service/BuildStatusService.php index d3a53d6e..7bd3a497 100644 --- a/src/PHPCensor/Service/BuildStatusService.php +++ b/src/PHPCensor/Service/BuildStatusService.php @@ -10,32 +10,44 @@ use PHPCensor\Model\Build; */ class BuildStatusService { - /* @var BuildStatusService */ + /** + * @var BuildStatusService + */ protected $prevService = null; - /* @var Project */ + /** + * @var Project + */ protected $project; - /** @var string */ + /** + * @var string + */ protected $branch; - /* @var Build */ + /** + * @var Build + */ protected $build; - /** @var string */ + /** + * @var string + */ protected $url; - /** @var array */ + /** + * @var array + */ protected $finishedStatusIds = [ Build::STATUS_SUCCESS, Build::STATUS_FAILED, ]; /** - * @param $branch + * @param string $branch * @param Project $project - * @param Build $build - * @param bool $isParent + * @param Build $build + * @param boolean $isParent */ public function __construct( $branch, @@ -55,7 +67,7 @@ class BuildStatusService } /** - * @param $url + * @param string $url */ public function setUrl($url) { @@ -71,7 +83,8 @@ class BuildStatusService } /** - * @param bool $isParent + * @param boolean $isParent + * * @throws \Exception */ protected function loadParentBuild($isParent = true) @@ -114,7 +127,7 @@ class BuildStatusService } /** - * @return bool + * @return boolean */ public function isFinished() { @@ -162,6 +175,7 @@ class BuildStatusService /** * @param Build $build + * * @return string */ public function getBuildStatus(Build $build) diff --git a/src/PHPCensor/Service/ProjectService.php b/src/PHPCensor/Service/ProjectService.php index 9d8628a7..5d54a079 100644 --- a/src/PHPCensor/Service/ProjectService.php +++ b/src/PHPCensor/Service/ProjectService.php @@ -46,11 +46,13 @@ class ProjectService /** * Update the properties of a given project. + * * @param Project $project * @param string $title * @param string $type * @param string $reference * @param array $options + * * @return \PHPCensor\Model\Project */ public function updateProject(Project $project, $title, $type, $reference, $options = []) @@ -111,7 +113,9 @@ class ProjectService /** * Delete a given project. + * * @param Project $project + * * @return bool */ public function deleteProject(Project $project) @@ -121,7 +125,9 @@ class ProjectService /** * In circumstances where it is necessary, populate access information based on other project properties. + * * @see ProjectService::createProject() + * * @param Project $project */ protected function processAccessInformation(Project &$project) diff --git a/src/PHPCensor/Service/UserService.php b/src/PHPCensor/Service/UserService.php index a0990aee..c3abd18d 100644 --- a/src/PHPCensor/Service/UserService.php +++ b/src/PHPCensor/Service/UserService.php @@ -25,14 +25,14 @@ class UserService /** * Create a new user. - * - * @param string $name - * @param string $email - * @param string $providerKey - * @param string $providerData - * @param string $password - * @param bool $isAdmin - * + * + * @param string $name + * @param string $email + * @param string $providerKey + * @param string $providerData + * @param string $password + * @param boolean $isAdmin + * * @return User */ public function createUser($name, $email, $providerKey, $providerData, $password, $isAdmin = false) @@ -50,15 +50,15 @@ class UserService /** * Update a user. - * + * * @param User $user * @param string $name * @param string $emailAddress * @param string $password - * @param bool $isAdmin + * @param boolean $isAdmin * @param string $language * @param integer $perPage - * + * * @return User */ public function updateUser(User $user, $name, $emailAddress, $password = null, $isAdmin = null, $language = null, $perPage = null) @@ -82,7 +82,9 @@ class UserService /** * Delete a user. + * * @param User $user + * * @return bool */ public function deleteUser(User $user) diff --git a/src/PHPCensor/Store.php b/src/PHPCensor/Store.php index 0a065b85..5a9ce1d6 100644 --- a/src/PHPCensor/Store.php +++ b/src/PHPCensor/Store.php @@ -4,5 +4,4 @@ namespace PHPCensor; abstract class Store extends \b8\Store { - } diff --git a/src/PHPCensor/Store/BuildErrorStore.php b/src/PHPCensor/Store/BuildErrorStore.php index 93749e85..c37fc44c 100644 --- a/src/PHPCensor/Store/BuildErrorStore.php +++ b/src/PHPCensor/Store/BuildErrorStore.php @@ -9,8 +9,19 @@ use PHPCensor\Store; class BuildErrorStore extends Store { - protected $tableName = 'build_error'; - protected $modelName = '\PHPCensor\Model\BuildError'; + /** + * @var string + */ + protected $tableName = 'build_error'; + + /** + * @var string + */ + protected $modelName = '\PHPCensor\Model\BuildError'; + + /** + * @var string + */ protected $primaryKey = 'id'; /** diff --git a/src/PHPCensor/Store/BuildErrorWriter.php b/src/PHPCensor/Store/BuildErrorWriter.php index d201669c..4e71b3c5 100644 --- a/src/PHPCensor/Store/BuildErrorWriter.php +++ b/src/PHPCensor/Store/BuildErrorWriter.php @@ -10,14 +10,19 @@ use b8\Database; */ class BuildErrorWriter { - /** @var int */ + /** + * @var integer + */ protected $buildId; - /** @var array */ + /** + * @var array + */ protected $errors = []; /** - * @var int + * @var integer + * * @see https://stackoverflow.com/questions/40361164/pdoexception-sqlstatehy000-general-error-7-number-of-parameters-must-be-bet */ protected $bufferSize; @@ -46,10 +51,10 @@ class BuildErrorWriter * * @param string $plugin * @param string $message - * @param int $severity + * @param integer $severity * @param string $file - * @param int $lineStart - * @param int $lineEnd + * @param integer $lineStart + * @param integer $lineEnd * @param \DateTime $createdDate */ public function write( diff --git a/src/PHPCensor/Store/BuildMetaStore.php b/src/PHPCensor/Store/BuildMetaStore.php index 74b40f62..56915cef 100644 --- a/src/PHPCensor/Store/BuildMetaStore.php +++ b/src/PHPCensor/Store/BuildMetaStore.php @@ -9,8 +9,19 @@ use b8\Exception\HttpException; class BuildMetaStore extends Store { + /** + * @var string + */ protected $tableName = 'build_meta'; + + /** + * @var string + */ protected $modelName = '\PHPCensor\Model\BuildMeta'; + + /** + * @var string + */ protected $primaryKey = 'id'; /** @@ -96,9 +107,9 @@ class BuildMetaStore extends Store /** * Only used by an upgrade migration to move errors from build_meta to build_error - * - * @param $limit - * + * + * @param integer $limit + * * @return array */ public function getErrorsForUpgrade($limit) diff --git a/src/PHPCensor/Store/BuildStore.php b/src/PHPCensor/Store/BuildStore.php index 7b03f00a..2c3feecb 100644 --- a/src/PHPCensor/Store/BuildStore.php +++ b/src/PHPCensor/Store/BuildStore.php @@ -12,8 +12,19 @@ use PHPCensor\Store; */ class BuildStore extends Store { + /** + * @var string + */ protected $tableName = 'build'; + + /** + * @var string + */ protected $modelName = '\PHPCensor\Model\Build'; + + /** + * @var string + */ protected $primaryKey = 'id'; /** @@ -226,8 +237,10 @@ class BuildStore extends Store /** * Return an array of the latest builds for all projects. - * @param int $limit_by_project - * @param int $limit_all + * + * @param integer $limit_by_project + * @param integer $limit_all + * * @return array */ public function getAllProjectsLatestBuilds($limit_by_project = 5, $limit_all = 10) @@ -312,10 +325,10 @@ class BuildStore extends Store /** * Return an array of builds for a given project and commit ID. - * + * * @param integer $projectId * @param string $commitId - * + * * @return array */ public function getByProjectAndCommit($projectId, $commitId) diff --git a/src/PHPCensor/Store/EnvironmentStore.php b/src/PHPCensor/Store/EnvironmentStore.php index c88bf0ed..bb9d1d9c 100644 --- a/src/PHPCensor/Store/EnvironmentStore.php +++ b/src/PHPCensor/Store/EnvironmentStore.php @@ -9,8 +9,19 @@ use b8\Exception\HttpException; class EnvironmentStore extends Store { + /** + * @var string + */ protected $tableName = 'environment'; + + /** + * @var string + */ protected $modelName = '\PHPCensor\Model\Environment'; + + /** + * @var string + */ protected $primaryKey = 'id'; /** diff --git a/src/PHPCensor/Store/ProjectGroupStore.php b/src/PHPCensor/Store/ProjectGroupStore.php index 1580d085..c53c8e17 100644 --- a/src/PHPCensor/Store/ProjectGroupStore.php +++ b/src/PHPCensor/Store/ProjectGroupStore.php @@ -9,8 +9,19 @@ use PHPCensor\Model\ProjectGroup; class ProjectGroupStore extends Store { + /** + * @var string + */ protected $tableName = 'project_group'; + + /** + * @var string + */ protected $modelName = '\PHPCensor\Model\ProjectGroup'; + + /** + * @var string + */ protected $primaryKey = 'id'; /** diff --git a/src/PHPCensor/Store/ProjectStore.php b/src/PHPCensor/Store/ProjectStore.php index a7bc49f8..b0ca6267 100644 --- a/src/PHPCensor/Store/ProjectStore.php +++ b/src/PHPCensor/Store/ProjectStore.php @@ -12,8 +12,19 @@ use b8\Exception\HttpException; */ class ProjectStore extends Store { + /** + * @var string + */ protected $tableName = 'project'; + + /** + * @var string + */ protected $modelName = '\PHPCensor\Model\Project'; + + /** + * @var string + */ protected $primaryKey = 'id'; /** @@ -60,7 +71,12 @@ class ProjectStore extends Store /** * Get a single Project by Ids. - * @param int[] + * + * @param integer[] $values + * @param string $useConnection + * + * @throws HttpException + * * @return Project[] */ public function getByIds($values, $useConnection = 'read') diff --git a/src/PHPCensor/Store/UserStore.php b/src/PHPCensor/Store/UserStore.php index 029195dd..8bb75a7b 100644 --- a/src/PHPCensor/Store/UserStore.php +++ b/src/PHPCensor/Store/UserStore.php @@ -12,8 +12,19 @@ use PHPCensor\Model\User; */ class UserStore extends Store { + /** + * @var string + */ protected $tableName = 'user'; + + /** + * @var string + */ protected $modelName = '\PHPCensor\Model\User'; + + /** + * @var string + */ protected $primaryKey = 'id'; /** diff --git a/src/PHPCensor/Worker/BuildWorker.php b/src/PHPCensor/Worker/BuildWorker.php index dcddb83a..446589da 100644 --- a/src/PHPCensor/Worker/BuildWorker.php +++ b/src/PHPCensor/Worker/BuildWorker.php @@ -19,24 +19,28 @@ class BuildWorker { /** * If this variable changes to false, the worker will stop after the current build. + * * @var bool */ protected $run = true; /** * The logger for builds to use. + * * @var \Monolog\Logger */ protected $logger; /** * beanstalkd host + * * @var string */ protected $host; /** * beanstalkd queue to watch + * * @var string */ protected $queue; @@ -52,8 +56,8 @@ class BuildWorker protected $totalJobs = 0; /** - * @param $host - * @param $queue + * @param string $host + * @param string $queue */ public function __construct($host, $queue) { @@ -147,9 +151,11 @@ class BuildWorker /** * Checks that the job received is actually, and has a valid type. - * @param Job $job - * @param $jobData - * @return bool + * + * @param Job $job + * @param array $jobData + * + * @return boolean */ protected function verifyJob(Job $job, $jobData) { diff --git a/src/PHPCensor/ZeroConfigPluginInterface.php b/src/PHPCensor/ZeroConfigPluginInterface.php index c258fe82..06ab844b 100644 --- a/src/PHPCensor/ZeroConfigPluginInterface.php +++ b/src/PHPCensor/ZeroConfigPluginInterface.php @@ -9,5 +9,12 @@ use PHPCensor\Model\Build; */ interface ZeroConfigPluginInterface { + /** + * @param string $stage + * @param Builder $builder + * @param Build $build + * + * @return mixed + */ public static function canExecute($stage, Builder $builder, Build $build); }