From bda4e22315d922a82e0cbc67d9d0694637bda84e Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Thu, 15 Oct 2015 10:17:22 +0100 Subject: [PATCH] Fixing PHPCI errors --- .phpci.yml | 1 + PHPCI/Model/Build.php | 4 ++++ PHPCI/Model/BuildError.php | 8 ++++++++ PHPCI/Store/BuildErrorStore.php | 6 ++++++ PHPCI/Store/BuildMetaStore.php | 6 ++++++ 5 files changed, 25 insertions(+) diff --git a/.phpci.yml b/.phpci.yml index 24ddfe69..b4fd52ec 100644 --- a/.phpci.yml +++ b/.phpci.yml @@ -8,6 +8,7 @@ build_settings: - "PHPCI/Migrations" # Ignore the migrations directory, as both PHPMD and PHPCS can't cope with them. - "PHPCI/Model/Base" # These files are auto-generated, and sometimes hit PHPMD complexity thresholds. - "PHPCI/Languages" # PHPCS fails on character counts for non-Latin languages + - "public/assets" # If there are any PHP files in here, we didn't write them. setup: composer: diff --git a/PHPCI/Model/Build.php b/PHPCI/Model/Build.php index b083ad1b..aab96635 100644 --- a/PHPCI/Model/Build.php +++ b/PHPCI/Model/Build.php @@ -276,6 +276,10 @@ class Build extends BuildBase exec(sprintf(IS_WIN ? 'rmdir /S /Q "%s"' : 'rm -Rf "%s"', $buildPath)); } + /** + * Get the number of seconds a build has been running for. + * @return int + */ public function getDuration() { $start = $this->getStarted(); diff --git a/PHPCI/Model/BuildError.php b/PHPCI/Model/BuildError.php index 3e5edf4a..8d005e26 100644 --- a/PHPCI/Model/BuildError.php +++ b/PHPCI/Model/BuildError.php @@ -19,6 +19,10 @@ class BuildError extends BuildErrorBase const SEVERITY_NORMAL = 2; const SEVERITY_LOW = 3; + /** + * Get the language string key for this error's severity level. + * @return string + */ public function getSeverityString() { switch ($this->getSeverity()) { @@ -36,6 +40,10 @@ class BuildError extends BuildErrorBase } } + /** + * Get the class to apply to HTML elements representing this error. + * @return string + */ public function getSeverityClass() { switch ($this->getSeverity()) { diff --git a/PHPCI/Store/BuildErrorStore.php b/PHPCI/Store/BuildErrorStore.php index 33918a39..9ba92310 100644 --- a/PHPCI/Store/BuildErrorStore.php +++ b/PHPCI/Store/BuildErrorStore.php @@ -16,6 +16,12 @@ use PHPCI\Store\Base\BuildErrorStoreBase; */ class BuildErrorStore extends BuildErrorStoreBase { + /** + * Get a list of errors for a given build, since a given time. + * @param $buildId + * @param string $since date string + * @return array + */ public function getErrorsForBuild($buildId, $since = null) { $query = 'SELECT * FROM build_error diff --git a/PHPCI/Store/BuildMetaStore.php b/PHPCI/Store/BuildMetaStore.php index 1fc0567d..15424f82 100644 --- a/PHPCI/Store/BuildMetaStore.php +++ b/PHPCI/Store/BuildMetaStore.php @@ -19,6 +19,12 @@ use PHPCI\Model\BuildMeta; */ 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($start, $limit) { $query = 'SELECT * FROM build_meta