From 180bdcf4fe04955de68b8109c6e86008a1c6bcd8 Mon Sep 17 00:00:00 2001 From: Marco Vito Moscaritolo Date: Sun, 31 May 2015 16:01:51 +0200 Subject: [PATCH] Improve CS. --- PHPCI/Controller/BuildController.php | 1 + PHPCI/Helper/BaseCommandExecutor.php | 10 ++++++++++ PHPCI/Store/Base/BuildMetaStoreBase.php | 19 ++++++++++++++----- PHPCI/Store/Base/BuildStoreBase.php | 16 +++++++++++++--- PHPCI/Store/Base/ProjectStoreBase.php | 13 ++++++++++--- PHPCI/Store/Base/UserStoreBase.php | 19 +++++++++++++++---- 6 files changed, 63 insertions(+), 15 deletions(-) diff --git a/PHPCI/Controller/BuildController.php b/PHPCI/Controller/BuildController.php index 006abe4b..cd4e3a58 100644 --- a/PHPCI/Controller/BuildController.php +++ b/PHPCI/Controller/BuildController.php @@ -223,6 +223,7 @@ class BuildController extends \PHPCI\Controller $response = new JsonResponse(); $response->setContent($rtn); + return $response; } diff --git a/PHPCI/Helper/BaseCommandExecutor.php b/PHPCI/Helper/BaseCommandExecutor.php index bd948834..0b3d3398 100644 --- a/PHPCI/Helper/BaseCommandExecutor.php +++ b/PHPCI/Helper/BaseCommandExecutor.php @@ -34,9 +34,19 @@ abstract class BaseCommandExecutor implements CommandExecutor */ protected $verbose; + /** + * @var string + */ protected $lastOutput; + + /** + * @var string + */ protected $lastError; + /** + * @var bool + */ public $logExecOutput = true; /** diff --git a/PHPCI/Store/Base/BuildMetaStoreBase.php b/PHPCI/Store/Base/BuildMetaStoreBase.php index 7a3d4159..7a493691 100644 --- a/PHPCI/Store/Base/BuildMetaStoreBase.php +++ b/PHPCI/Store/Base/BuildMetaStoreBase.php @@ -22,8 +22,10 @@ class BuildMetaStoreBase extends Store /** * Returns a BuildMeta model by primary key. + * * @param mixed $value * @param string $useConnection + * * @return \@appNamespace\Model\BuildMeta|null */ public function getByPrimaryKey($value, $useConnection = 'read') @@ -33,10 +35,13 @@ class BuildMetaStoreBase extends Store /** * Returns a BuildMeta model by Id. + * * @param mixed $value * @param string $useConnection - * @throws HttpException + * * @return \@appNamespace\Model\BuildMeta|null + * + * @throws HttpException */ public function getById($value, $useConnection = 'read') { @@ -59,11 +64,14 @@ class BuildMetaStoreBase extends Store /** * Returns an array of BuildMeta models by ProjectId. + * * @param mixed $value * @param int $limit * @param string $useConnection - * @throws HttpException + * * @return array + * + * @throws HttpException */ public function getByProjectId($value, $limit = 1000, $useConnection = 'read') { @@ -71,7 +79,6 @@ class BuildMetaStoreBase extends Store throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.'); } - $query = 'SELECT * FROM `build_meta` WHERE `project_id` = :project_id LIMIT :limit'; $stmt = Database::getConnection($useConnection)->prepare($query); $stmt->bindValue(':project_id', $value); @@ -95,11 +102,14 @@ class BuildMetaStoreBase extends Store /** * Returns an array of BuildMeta models by BuildId. + * * @param mixed $value * @param int $limit * @param string $useConnection - * @throws HttpException + * * @return array + * + * @throws HttpException */ public function getByBuildId($value, $limit = 1000, $useConnection = 'read') { @@ -107,7 +117,6 @@ class BuildMetaStoreBase extends Store throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.'); } - $query = 'SELECT * FROM `build_meta` WHERE `build_id` = :build_id LIMIT :limit'; $stmt = Database::getConnection($useConnection)->prepare($query); $stmt->bindValue(':build_id', $value); diff --git a/PHPCI/Store/Base/BuildStoreBase.php b/PHPCI/Store/Base/BuildStoreBase.php index 0560d72b..3d1d5cec 100644 --- a/PHPCI/Store/Base/BuildStoreBase.php +++ b/PHPCI/Store/Base/BuildStoreBase.php @@ -22,8 +22,10 @@ class BuildStoreBase extends Store /** * Returns a Build model by primary key. + * * @param mixed $value * @param string $useConnection + * * @return \@appNamespace\Model\Build|null */ public function getByPrimaryKey($value, $useConnection = 'read') @@ -33,10 +35,13 @@ class BuildStoreBase extends Store /** * Returns a Build model by Id. + * * @param mixed $value * @param string $useConnection - * @throws HttpException + * * @return \@appNamespace\Model\Build|null + * + * @throws HttpException */ public function getById($value, $useConnection = 'read') { @@ -59,10 +64,13 @@ class BuildStoreBase extends Store /** * Returns an array of Build models by ProjectId. + * * @param mixed $value * @param int $limit * @param string $useConnection + * * @throws HttpException + * * @return array */ public function getByProjectId($value, $limit = 1000, $useConnection = 'read') @@ -95,11 +103,14 @@ class BuildStoreBase extends Store /** * Returns an array of Build models by Status. + * * @param mixed $value * @param int $limit * @param string $useConnection - * @throws HttpException + * * @return array + * + * @throws HttpException */ public function getByStatus($value, $limit = 1000, $useConnection = 'read') { @@ -107,7 +118,6 @@ class BuildStoreBase extends Store throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.'); } - $query = 'SELECT * FROM `build` WHERE `status` = :status LIMIT :limit'; $stmt = Database::getConnection($useConnection)->prepare($query); $stmt->bindValue(':status', $value); diff --git a/PHPCI/Store/Base/ProjectStoreBase.php b/PHPCI/Store/Base/ProjectStoreBase.php index 562afba2..4fab932c 100644 --- a/PHPCI/Store/Base/ProjectStoreBase.php +++ b/PHPCI/Store/Base/ProjectStoreBase.php @@ -22,8 +22,10 @@ class ProjectStoreBase extends Store /** * Returns a Project model by primary key. + * * @param mixed $value * @param string $useConnection + * * @return \@appNamespace\Model\Project|null */ public function getByPrimaryKey($value, $useConnection = 'read') @@ -33,10 +35,13 @@ class ProjectStoreBase extends Store /** * Returns a Project model by Id. + * * @param mixed $value * @param string $useConnection - * @throws HttpException + * * @return \@appNamespace\Model\Project|null + * + * @throws HttpException */ public function getById($value, $useConnection = 'read') { @@ -59,11 +64,14 @@ class ProjectStoreBase extends Store /** * Returns an array of Project models by Title. + * * @param mixed $value * @param int $limit * @param string $useConnection - * @throws HttpException + * * @return array + * + * @throws HttpException */ public function getByTitle($value, $limit = 1000, $useConnection = 'read') { @@ -71,7 +79,6 @@ class ProjectStoreBase extends Store throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.'); } - $query = 'SELECT * FROM `project` WHERE `title` = :title LIMIT :limit'; $stmt = Database::getConnection($useConnection)->prepare($query); $stmt->bindValue(':title', $value); diff --git a/PHPCI/Store/Base/UserStoreBase.php b/PHPCI/Store/Base/UserStoreBase.php index f2893ac5..36cbb389 100644 --- a/PHPCI/Store/Base/UserStoreBase.php +++ b/PHPCI/Store/Base/UserStoreBase.php @@ -22,8 +22,10 @@ class UserStoreBase extends Store /** * Returns a User model by primary key. + * * @param mixed $value * @param string $useConnection + * * @return \@appNamespace\Model\User|null */ public function getByPrimaryKey($value, $useConnection = 'read') @@ -33,10 +35,13 @@ class UserStoreBase extends Store /** * Returns a User model by Id. + * * @param mixed $value * @param string $useConnection - * @throws HttpException + * * @return \@appNamespace\Model\User|null + * + * @throws HttpException */ public function getById($value, $useConnection = 'read') { @@ -59,10 +64,13 @@ class UserStoreBase extends Store /** * Returns a User model by Email. + * * @param string $value * @param string $useConnection + * + * @return \@appNamespace\Model\User|null + * * @throws HttpException - * @return \@appNamespace\Model\User|null */ public function getByEmail($value, $useConnection = 'read') { @@ -82,13 +90,16 @@ class UserStoreBase extends Store return null; } - + /** * Returns a User model by Email. + * * @param string $value * @param string $useConnection - * @throws HttpException + * * @return \@appNamespace\Model\User|null + * + * @throws HttpException */ public function getByLoginOrEmail($value, $useConnection = 'read') {