diff --git a/PHPCI/Plugin.php b/PHPCI/Plugin.php index ac2960cd..6627463e 100644 --- a/PHPCI/Plugin.php +++ b/PHPCI/Plugin.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -10,10 +10,13 @@ namespace PHPCI; /** -* PHPCI Plugin Interface - Used by all build plugins. -* @author Dan Cryer -*/ -interface Plugin + * PHPCI Plugin Interface - Used by all build plugins. + * + * @author Dan Cryer + * @deprecated 1.8 Only for backward compatibility + * @see PluginInterface + */ +interface Plugin extends PluginInterface { - public function execute(); + } diff --git a/PHPCI/Plugin/Atoum.php b/PHPCI/Plugin/Atoum.php index 877f009b..12a36921 100644 --- a/PHPCI/Plugin/Atoum.php +++ b/PHPCI/Plugin/Atoum.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,12 +12,20 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Helper\Lang; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** - * Atoum plugin, runs Atoum tests within a project. - * @package PHPCI\Plugin + * Atoum plugin + * + * Runs Atoum tests within a project. + * + * @author Sanpi + * @author André Cianfarani + * @author Dan Cryer + * @package PHPCI + * @subpackage Plugins */ -class Atoum implements \PHPCI\Plugin +class Atoum implements PluginInterface { private $args; private $config; @@ -25,6 +33,7 @@ class Atoum implements \PHPCI\Plugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param array $options @@ -54,8 +63,7 @@ class Atoum implements \PHPCI\Plugin } /** - * Run the Atoum plugin. - * @return bool + * {@inheritDocs} */ public function execute() { @@ -84,7 +92,7 @@ class Atoum implements \PHPCI\Plugin $status = false; $this->phpci->log(Lang::get('no_tests_performed')); } - + return $status; } } diff --git a/PHPCI/Plugin/Behat.php b/PHPCI/Plugin/Behat.php index 445d7191..23629051 100644 --- a/PHPCI/Plugin/Behat.php +++ b/PHPCI/Plugin/Behat.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,16 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Helper\Lang; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** * Behat BDD Plugin + * * @author Dan Cryer * @package PHPCI * @subpackage Plugins */ -class Behat implements \PHPCI\Plugin +class Behat implements PluginInterface { protected $phpci; protected $build; @@ -55,7 +57,7 @@ class Behat implements \PHPCI\Plugin } /** - * Runs Behat tests. + * {@inheritDocs} */ public function execute() { diff --git a/PHPCI/Plugin/Campfire.php b/PHPCI/Plugin/Campfire.php index 325e6e40..5db95d3a 100644 --- a/PHPCI/Plugin/Campfire.php +++ b/PHPCI/Plugin/Campfire.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,15 +12,18 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Helper\Lang; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** - * Campfire Plugin - Allows Campfire API actions. - * strongly based on icecube (http://labs.mimmin.com/icecube) + * Campfire Plugin + * + * Allows Campfire API actions, strongly based on icecube (http://labs.mimmin.com/icecube) + * * @author André Cianfarani * @package PHPCI * @subpackage Plugins */ -class Campfire implements \PHPCI\Plugin +class Campfire implements PluginInterface { private $url; private $authToken; @@ -31,6 +34,7 @@ class Campfire implements \PHPCI\Plugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param array $options @@ -58,8 +62,7 @@ class Campfire implements \PHPCI\Plugin } /** - * Run the Campfire plugin. - * @return bool|mixed + * {@inheritDocs} */ public function execute() { diff --git a/PHPCI/Plugin/CleanBuild.php b/PHPCI/Plugin/CleanBuild.php index 2d33aee4..d9970440 100644 --- a/PHPCI/Plugin/CleanBuild.php +++ b/PHPCI/Plugin/CleanBuild.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -11,15 +11,19 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** -* Clean build removes Composer related files and allows PHPCI users to clean up their build directory. -* Useful as a precursor to copy_build. -* @author Dan Cryer -* @package PHPCI -* @subpackage Plugins -*/ -class CleanBuild implements \PHPCI\Plugin + * Clean build Plugin + * + * Removes Composer related files and allows PHPCI users to clean up their build + * directory. Useful as a precursor to copy_build. + * + * @author Dan Cryer + * @package PHPCI + * @subpackage Plugins + */ +class CleanBuild implements PluginInterface { protected $remove; protected $phpci; @@ -45,8 +49,8 @@ class CleanBuild implements \PHPCI\Plugin } /** - * Executes Composer and runs a specified command (e.g. install / update) - */ + * {@inheritDocs} + */ public function execute() { $cmd = 'rm -Rf "%s"'; @@ -57,7 +61,7 @@ class CleanBuild implements \PHPCI\Plugin $this->phpci->executeCommand($cmd, $this->phpci->buildPath . 'composer.lock'); $success = true; - + foreach ($this->remove as $file) { $ok = $this->phpci->executeCommand($cmd, $this->phpci->buildPath . $file); diff --git a/PHPCI/Plugin/Codeception.php b/PHPCI/Plugin/Codeception.php index fe12db76..6bafeee7 100644 --- a/PHPCI/Plugin/Codeception.php +++ b/PHPCI/Plugin/Codeception.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -14,16 +14,21 @@ use PHPCI\Helper\Lang; use PHPCI\Model\Build; use PHPCI\Plugin\Util\TestResultParsers\Codeception as Parser; use Psr\Log\LogLevel; +use PHPCI\PluginInterface; +use PHPCI\PluginZeroConfigInterface; /** - * Codeception Plugin - Enables full acceptance, unit, and functional testing. + * Codeception Plugin + * + * Enables full acceptance, unit, and functional testing. + * * @author Don Gilbert * @author Igor Timoshenko * @author Adam Cooper * @package PHPCI * @subpackage Plugins */ -class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin +class Codeception implements PluginInterface, PluginZeroConfigInterface { /** @var string */ protected $args = ''; @@ -45,10 +50,7 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin protected $path; /** - * @param $stage - * @param Builder $builder - * @param Build $build - * @return bool + * {@inheritDocs} */ public static function canExecute($stage, Builder $builder, Build $build) { @@ -61,7 +63,9 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin /** * Try and find the codeception YML config file. + * * @param $buildPath + * * @return null|string */ public static function findConfigFile($buildPath) @@ -79,6 +83,7 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param array $options @@ -104,7 +109,7 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin } /** - * Runs Codeception tests, optionally using specified config file(s). + * {@inheritDocs} */ public function execute() { @@ -123,8 +128,11 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin /** * Run tests from a Codeception config file. + * * @param $configPath + * * @return bool|mixed + * * @throws \Exception */ protected function runConfigFile($configPath) diff --git a/PHPCI/Plugin/Composer.php b/PHPCI/Plugin/Composer.php index 87a558fe..9e7a5250 100644 --- a/PHPCI/Plugin/Composer.php +++ b/PHPCI/Plugin/Composer.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -13,14 +13,19 @@ use PHPCI; use PHPCI\Builder; use PHPCI\Model\Build; use PHPCI\Helper\Lang; +use PHPCI\PluginInterface; +use PHPCI\PluginZeroConfigInterface; /** -* Composer Plugin - Provides access to Composer functionality. -* @author Dan Cryer -* @package PHPCI -* @subpackage Plugins -*/ -class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin + * Composer Plugin + * + * Provides access to Composer functionality. + * + * @author Dan Cryer + * @package PHPCI + * @subpackage Plugins + */ +class Composer implements PluginInterface, PluginZeroConfigInterface { protected $directory; protected $action; @@ -29,11 +34,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin protected $build; /** - * Check if this plugin can be executed. - * @param $stage - * @param Builder $builder - * @param Build $build - * @return bool + * {@inheritDocs} */ public static function canExecute($stage, Builder $builder, Build $build) { @@ -48,6 +49,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param array $options @@ -75,8 +77,8 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } /** - * Executes Composer and runs a specified command (e.g. install / update) - */ + * {@inheritDocs} + */ public function execute() { $composerLocation = $this->phpci->findBinary(array('composer', 'composer.phar')); diff --git a/PHPCI/Plugin/CopyBuild.php b/PHPCI/Plugin/CopyBuild.php index 7f447291..00f5a8ea 100644 --- a/PHPCI/Plugin/CopyBuild.php +++ b/PHPCI/Plugin/CopyBuild.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,18 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Model\Build; use PHPCI\Helper\Lang; +use PHPCI\PluginInterface; /** -* Copy Build Plugin - Copies the entire build to another directory. -* @author Dan Cryer -* @package PHPCI -* @subpackage Plugins -*/ -class CopyBuild implements \PHPCI\Plugin + * Copy Build Plugin + * + * Copies the entire build to another directory. + * + * @author Dan Cryer + * @package PHPCI + * @subpackage Plugins + */ +class CopyBuild implements PluginInterface { protected $directory; protected $ignore; @@ -29,6 +33,7 @@ class CopyBuild implements \PHPCI\Plugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param array $options @@ -44,8 +49,8 @@ class CopyBuild implements \PHPCI\Plugin } /** - * Copies files from the root of the build directory into the target folder - */ + * {@inheritDocs} + */ public function execute() { $build = $this->phpci->buildPath; @@ -70,6 +75,7 @@ class CopyBuild implements \PHPCI\Plugin /** * Wipe the destination directory if it already exists. + * * @throws \Exception */ protected function wipeExistingDirectory() diff --git a/PHPCI/Plugin/Email.php b/PHPCI/Plugin/Email.php index 8414451f..1eea2b02 100644 --- a/PHPCI/Plugin/Email.php +++ b/PHPCI/Plugin/Email.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -14,14 +14,18 @@ use PHPCI\Builder; use PHPCI\Helper\Lang; use PHPCI\Model\Build; use PHPCI\Helper\Email as EmailHelper; +use PHPCI\PluginInterface; /** -* Email Plugin - Provides simple email capability to PHPCI. -* @author Steve Brazier -* @package PHPCI -* @subpackage Plugins -*/ -class Email implements \PHPCI\Plugin + * Email Plugin + * + * Provides simple email capability to PHPCI. + * + * @author Steve Brazier + * @package PHPCI + * @subpackage Plugins + */ +class Email implements PluginInterface { /** * @var \PHPCI\Builder @@ -40,6 +44,7 @@ class Email implements \PHPCI\Plugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param \Swift_Mailer $mailer @@ -56,7 +61,7 @@ class Email implements \PHPCI\Plugin } /** - * Send a notification mail. + * {@inheritDocs} */ public function execute() { @@ -91,11 +96,14 @@ class Email implements \PHPCI\Plugin } /** - * @param string $toAddress Single address to send to - * @param string[] $ccList - * @param string $subject Email subject - * @param string $body Email body - * @return array Array of failed addresses + * Send a mail using the specified information. + * + * @param string $toAddress Single address to send to + * @param string[] $ccList List of user to CC + * @param string $subject Email subject + * @param string $body Email body + * + * @return array Array of failed addresses */ public function sendEmail($toAddress, $ccList, $subject, $body) { @@ -118,14 +126,11 @@ class Email implements \PHPCI\Plugin /** * Send an email to a list of specified subjects. * - * @param array $toAddresses - * List of destinatary of message. - * @param string $subject - * Mail subject - * @param string $body - * Mail body + * @param array $toAddresses List of destinatary of message. + * @param string $subject Mail subject + * @param string $body Mail body * - * @return int number of failed messages + * @return int number of failed messages */ public function sendSeparateEmails(array $toAddresses, $subject, $body) { @@ -142,6 +147,7 @@ class Email implements \PHPCI\Plugin /** * Get the list of email addresses to send to. + * * @return array */ protected function getEmailAddresses() @@ -168,6 +174,7 @@ class Email implements \PHPCI\Plugin /** * Get the list of email addresses to CC. + * * @return array */ protected function getCcAddresses() diff --git a/PHPCI/Plugin/Env.php b/PHPCI/Plugin/Env.php index 4e4b6563..32a7ce08 100644 --- a/PHPCI/Plugin/Env.php +++ b/PHPCI/Plugin/Env.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,16 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Helper\Lang; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** -* Environment variable plugin -* @author Steve Kamerman -* @package PHPCI -* @subpackage Plugins -*/ -class Env implements \PHPCI\Plugin + * Environment variable plugin + * + * @author Steve Kamerman + * @package PHPCI + * @subpackage Plugins + */ +class Env implements PluginInterface { protected $phpci; protected $build; @@ -27,6 +29,7 @@ class Env implements \PHPCI\Plugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param array $options @@ -39,8 +42,8 @@ class Env implements \PHPCI\Plugin } /** - * Adds the specified environment variables to the builder environment - */ + * {@inheritDocs} + */ public function execute() { $success = true; @@ -52,7 +55,7 @@ class Env implements \PHPCI\Plugin // This allows the standard syntax: "FOO: bar" $env_var = "$key=$value"; } - + if (!putenv($this->phpci->interpolate($env_var))) { $success = false; $this->phpci->logFailure(Lang::get('unable_to_set_env')); diff --git a/PHPCI/Plugin/Exception/PluginBinaryNotFoundException.php b/PHPCI/Plugin/Exception/PluginBinaryNotFoundException.php new file mode 100644 index 00000000..2d8bd56a --- /dev/null +++ b/PHPCI/Plugin/Exception/PluginBinaryNotFoundException.php @@ -0,0 +1,17 @@ + * @package PHPCI * @subpackage Plugins */ -class Git implements \PHPCI\Plugin +class Git implements PluginInterface { protected $phpci; protected $build; @@ -27,6 +29,7 @@ class Git implements \PHPCI\Plugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param array $options @@ -39,8 +42,7 @@ class Git implements \PHPCI\Plugin } /** - * Run the Git plugin. - * @return bool + * {@inheritDocs} */ public function execute() { @@ -70,8 +72,10 @@ class Git implements \PHPCI\Plugin /** * Determine which action to run, and run it. + * * @param $action * @param array $options + * * @return bool */ protected function runAction($action, array $options = array()) @@ -96,6 +100,7 @@ class Git implements \PHPCI\Plugin /** * Handle a merge action. + * * @param $options * @return bool */ @@ -110,6 +115,7 @@ class Git implements \PHPCI\Plugin /** * Handle a tag action. + * * @param $options * @return bool */ @@ -132,6 +138,7 @@ class Git implements \PHPCI\Plugin /** * Handle a pull action. + * * @param $options * @return bool */ @@ -153,6 +160,7 @@ class Git implements \PHPCI\Plugin /** * Handle a push action. + * * @param $options * @return bool */ diff --git a/PHPCI/Plugin/Grunt.php b/PHPCI/Plugin/Grunt.php index 1ad0ceec..be5ba0c9 100644 --- a/PHPCI/Plugin/Grunt.php +++ b/PHPCI/Plugin/Grunt.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -11,14 +11,18 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** -* Grunt Plugin - Provides access to grunt functionality. -* @author Tobias Tom -* @package PHPCI -* @subpackage Plugins -*/ -class Grunt implements \PHPCI\Plugin + * Grunt Plugin + * + * Provides access to grunt functionality. + * + * @author Tobias Tom + * @package PHPCI + * @subpackage Plugins + */ +class Grunt implements PluginInterface { protected $directory; protected $task; @@ -69,8 +73,8 @@ class Grunt implements \PHPCI\Plugin } /** - * Executes grunt and runs a specified command (e.g. install / update) - */ + * {@inheritDocs} + */ public function execute() { // if npm does not work, we cannot use grunt, so we return false diff --git a/PHPCI/Plugin/Gulp.php b/PHPCI/Plugin/Gulp.php index 97ad9246..a790340a 100644 --- a/PHPCI/Plugin/Gulp.php +++ b/PHPCI/Plugin/Gulp.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -11,14 +11,18 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** -* Gulp Plugin - Provides access to gulp functionality. -* @author Dirk Heilig -* @package PHPCI -* @subpackage Plugins -*/ -class Gulp implements \PHPCI\Plugin + * Gulp Plugin + * + * Provides access to gulp functionality. + * + * @author Dirk Heilig + * @package PHPCI + * @subpackage Plugins + */ +class Gulp implements PluginInterface { protected $directory; protected $task; @@ -69,8 +73,8 @@ class Gulp implements \PHPCI\Plugin } /** - * Executes gulp and runs a specified command (e.g. install / update) - */ + * {@inheritDocs} + */ public function execute() { // if npm does not work, we cannot use gulp, so we return false diff --git a/PHPCI/Plugin/HipchatNotify.php b/PHPCI/Plugin/HipchatNotify.php index a39b94fe..5dabb20a 100644 --- a/PHPCI/Plugin/HipchatNotify.php +++ b/PHPCI/Plugin/HipchatNotify.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,18 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Helper\Lang; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** - * Hipchat Plugin + * Hipchat Plugin. + * + * Send build notification in HipChat. + * * @author James Inman * @package PHPCI * @subpackage Plugins */ -class HipchatNotify implements \PHPCI\Plugin +class HipchatNotify implements PluginInterface { protected $authToken; protected $color; @@ -27,9 +31,11 @@ class HipchatNotify implements \PHPCI\Plugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param array $options + * * @throws \Exception */ public function __construct(Builder $phpci, Build $build, array $options = array()) @@ -68,8 +74,7 @@ class HipchatNotify implements \PHPCI\Plugin } /** - * Run the HipChat plugin. - * @return bool + * {@inheritDocs} */ public function execute() { diff --git a/PHPCI/Plugin/Irc.php b/PHPCI/Plugin/Irc.php index a7610a8c..3b333c75 100644 --- a/PHPCI/Plugin/Irc.php +++ b/PHPCI/Plugin/Irc.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,18 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Helper\Lang; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** - * IRC Plugin - Sends a notification to an IRC channel + * IRC Plugin + * + * Sends a notification to an IRC channel. + * * @author Dan Cryer * @package PHPCI * @subpackage Plugins */ -class Irc implements \PHPCI\Plugin +class Irc implements PluginInterface { protected $phpci; protected $build; @@ -61,8 +65,7 @@ class Irc implements \PHPCI\Plugin } /** - * Run IRC plugin. - * @return bool + * {@inheritDocs} */ public function execute() { @@ -93,8 +96,11 @@ class Irc implements \PHPCI\Plugin } /** + * Execute a list of IRC commands. + * * @param resource $socket * @param array $commands + * * @return bool */ private function executeIrcCommands($socket, array $commands) @@ -120,9 +126,11 @@ class Irc implements \PHPCI\Plugin } /** + * Execute a single IRC command. * * @param resource $socket * @param string $command + * * @return bool */ private function executeIrcCommand($socket, $command) diff --git a/PHPCI/Plugin/Lint.php b/PHPCI/Plugin/Lint.php index 90436d70..8e425caf 100644 --- a/PHPCI/Plugin/Lint.php +++ b/PHPCI/Plugin/Lint.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,18 @@ namespace PHPCI\Plugin; use PHPCI; use PHPCI\Builder; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** - * PHP Lint Plugin - Provides access to PHP lint functionality. + * PHP Lint Plugin + * + * Provides access to PHP lint functionality. + * * @author Dan Cryer * @package PHPCI * @subpackage Plugins */ -class Lint implements PHPCI\Plugin +class Lint implements PluginInterface { protected $directories; protected $recursive = true; @@ -60,7 +64,7 @@ class Lint implements PHPCI\Plugin } /** - * Executes parallel lint + * {@inheritDocs} */ public function execute() { @@ -82,9 +86,11 @@ class Lint implements PHPCI\Plugin /** * Lint an item (file or directory) by calling the appropriate method. + * * @param $php * @param $item * @param $itemPath + * * @return bool */ protected function lintItem($php, $item, $itemPath) @@ -102,8 +108,10 @@ class Lint implements PHPCI\Plugin /** * Run php -l against a directory of files. + * * @param $php * @param $path + * * @return bool */ protected function lintDirectory($php, $path) @@ -132,8 +140,10 @@ class Lint implements PHPCI\Plugin /** * Run php -l against a specific file. + * * @param $php * @param $path + * * @return bool */ protected function lintFile($php, $path) diff --git a/PHPCI/Plugin/Mysql.php b/PHPCI/Plugin/Mysql.php index 5c36a09f..1da779fb 100644 --- a/PHPCI/Plugin/Mysql.php +++ b/PHPCI/Plugin/Mysql.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -13,15 +13,19 @@ use PDO; use PHPCI\Builder; use PHPCI\Helper\Lang; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** -* MySQL Plugin - Provides access to a MySQL database. -* @author Dan Cryer -* @author Steve Kamerman -* @package PHPCI -* @subpackage Plugins -*/ -class Mysql implements \PHPCI\Plugin + * MySQL Plugin + * + * Provides access to a MySQL database. + * + * @author Dan Cryer + * @author Steve Kamerman + * @package PHPCI + * @subpackage Plugins + */ +class Mysql implements PluginInterface { /** * @var \PHPCI\Builder @@ -91,9 +95,8 @@ class Mysql implements \PHPCI\Plugin } /** - * Connects to MySQL and runs a specified set of queries. - * @return boolean - */ + * {@inheritDocs} + */ public function execute() { try { @@ -120,7 +123,9 @@ class Mysql implements \PHPCI\Plugin /** * @param string $query + * * @return boolean + * * @throws \Exception */ protected function executeFile($query) @@ -146,8 +151,10 @@ class Mysql implements \PHPCI\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 + * @param string $database If specified, this database is selected before execution + * * @return string */ protected function getImportCommand($import_file, $database = null) diff --git a/PHPCI/Plugin/PackageBuild.php b/PHPCI/Plugin/PackageBuild.php index 8e40c71f..ffa75857 100644 --- a/PHPCI/Plugin/PackageBuild.php +++ b/PHPCI/Plugin/PackageBuild.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -11,14 +11,16 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** -* Create a ZIP or TAR.GZ archive of the entire build. -* @author Dan Cryer -* @package PHPCI -* @subpackage Plugins -*/ -class PackageBuild implements \PHPCI\Plugin + * Create a ZIP or TAR.GZ archive of the entire build. + * + * @author Dan Cryer + * @package PHPCI + * @subpackage Plugins + */ +class PackageBuild implements PluginInterface { protected $directory; protected $filename; @@ -27,6 +29,7 @@ class PackageBuild implements \PHPCI\Plugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param array $options @@ -42,8 +45,8 @@ class PackageBuild implements \PHPCI\Plugin } /** - * Executes Composer and runs a specified command (e.g. install / update) - */ + * {@inheritDocs} + */ public function execute() { $path = $this->phpci->buildPath; diff --git a/PHPCI/Plugin/Pdepend.php b/PHPCI/Plugin/Pdepend.php index 73b669c1..e3a2e19f 100644 --- a/PHPCI/Plugin/Pdepend.php +++ b/PHPCI/Plugin/Pdepend.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,18 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Helper\Lang; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** - * Pdepend Plugin - Allows Pdepend report + * Pdepend Plugin + * + * Allows Pdepend report + * * @author Johan van der Heide * @package PHPCI * @subpackage Plugins */ -class Pdepend implements \PHPCI\Plugin +class Pdepend implements PluginInterface { protected $args; /** @@ -50,6 +54,7 @@ class Pdepend implements \PHPCI\Plugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param array $options @@ -69,7 +74,7 @@ class Pdepend implements \PHPCI\Plugin } /** - * Runs Pdepend with the given criteria as arguments + * {@inheritDocs} */ public function execute() { diff --git a/PHPCI/Plugin/Pgsql.php b/PHPCI/Plugin/Pgsql.php index 9d0f924d..61ce6074 100644 --- a/PHPCI/Plugin/Pgsql.php +++ b/PHPCI/Plugin/Pgsql.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,18 @@ namespace PHPCI\Plugin; use PDO; use PHPCI\Builder; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** -* PgSQL Plugin - Provides access to a PgSQL database. -* @author Dan Cryer -* @package PHPCI -* @subpackage Plugins -*/ -class Pgsql implements \PHPCI\Plugin + * PgSQL Plugin + * + * Provides access to a PgSQL database. + * + * @author Dan Cryer + * @package PHPCI + * @subpackage Plugins + */ +class Pgsql implements PluginInterface { /** * @var \PHPCI\Builder @@ -73,9 +77,8 @@ class Pgsql implements \PHPCI\Plugin } /** - * Connects to PgSQL and runs a specified set of queries. - * @return boolean - */ + * {@inheritDocs} + */ public function execute() { try { diff --git a/PHPCI/Plugin/Phar.php b/PHPCI/Plugin/Phar.php index 0500fddc..b8f0de7a 100644 --- a/PHPCI/Plugin/Phar.php +++ b/PHPCI/Plugin/Phar.php @@ -1,16 +1,31 @@ + * @package PHPCI + * @subpackage Plugins */ -class Phar implements \PHPCI\Plugin +class Phar implements PluginInterface { /** * PHPCI @@ -111,6 +126,7 @@ class Phar implements \PHPCI\Plugin * Directory Setter * * @param string $directory Configuration Value + * * @return Phar Fluent Interface */ public function setDirectory($directory) @@ -136,6 +152,7 @@ class Phar implements \PHPCI\Plugin * Filename Setter * * @param string $filename Configuration Value + * * @return Phar Fluent Interface */ public function setFilename($filename) @@ -161,6 +178,7 @@ class Phar implements \PHPCI\Plugin * Regular Expression Setter * * @param string $regexp Configuration Value + * * @return Phar Fluent Interface */ public function setRegExp($regexp) @@ -186,6 +204,7 @@ class Phar implements \PHPCI\Plugin * Stub Filename Setter * * @param string $stub Configuration Value + * * @return Phar Fluent Interface */ public function setStub($stub) @@ -206,6 +225,7 @@ class Phar implements \PHPCI\Plugin /** * Get stub content for the Phar file. + * * @return string */ public function getStubContent() @@ -219,8 +239,7 @@ class Phar implements \PHPCI\Plugin } /** - * Run the phar plugin. - * @return bool + * {@inheritDocs} */ public function execute() { diff --git a/PHPCI/Plugin/Phing.php b/PHPCI/Plugin/Phing.php index 3a5bd834..e4be6ae2 100644 --- a/PHPCI/Plugin/Phing.php +++ b/PHPCI/Plugin/Phing.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,15 +12,18 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Helper\Lang; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** - * Phing Plugin - Provides access to Phing functionality. + * Phing Plugin + * + * Provides access to Phing functionality. * * @author Pavel Pavlov * @package PHPCI * @subpackage Plugins */ -class Phing implements \PHPCI\Plugin +class Phing implements PluginInterface { private $directory; @@ -34,6 +37,7 @@ class Phing implements \PHPCI\Plugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param array $options @@ -43,9 +47,7 @@ class Phing implements \PHPCI\Plugin $this->setPhpci($phpci); $this->build = $build; - /* - * Set working directory - */ + // Set working directory if (isset($options['directory'])) { $directory = $phpci->buildPath . '/' . $options['directory']; } else { @@ -54,9 +56,7 @@ class Phing implements \PHPCI\Plugin $this->setDirectory($directory); - /* - * Sen name of a non default build file - */ + // Set name of a non default build file if (isset($options['build_file'])) { $this->setBuildFile($options['build_file']); } @@ -75,7 +75,7 @@ class Phing implements \PHPCI\Plugin } /** - * Executes Phing and runs a specified targets + * {@inheritDocs} */ public function execute() { @@ -97,7 +97,7 @@ class Phing implements \PHPCI\Plugin } /** - * @return \PHPCI\Builder + * @return Builder */ public function getPhpci() { @@ -105,7 +105,7 @@ class Phing implements \PHPCI\Plugin } /** - * @param \PHPCI\Builder $phpci + * @param Builder $phpci * * @return $this */ @@ -142,6 +142,7 @@ class Phing implements \PHPCI\Plugin /** * Converts an array of targets into a string. + * * @return string */ private function targetsToString() @@ -175,6 +176,7 @@ class Phing implements \PHPCI\Plugin * @param mixed $buildFile * * @return $this + * * @throws \Exception */ public function setBuildFile($buildFile) @@ -188,6 +190,7 @@ class Phing implements \PHPCI\Plugin /** * Get phing build file path. + * * @return string */ public function getBuildFilePath() @@ -208,10 +211,8 @@ class Phing implements \PHPCI\Plugin */ public function propertiesToString() { - /** - * fix the problem when execute phing out of the build dir - * @ticket 748 - */ + // Fix the problem when execute phing out of the build dir + // @ticket 748 if (!isset($this->properties['project.basedir'])) { $this->properties['project.basedir'] = $this->getDirectory(); } @@ -251,6 +252,7 @@ class Phing implements \PHPCI\Plugin * @param string $propertyFile * * @return $this + * * @throws \Exception */ public function setPropertyFile($propertyFile) diff --git a/PHPCI/Plugin/PhpCodeSniffer.php b/PHPCI/Plugin/PhpCodeSniffer.php index 877d24c6..7ab50955 100644 --- a/PHPCI/Plugin/PhpCodeSniffer.php +++ b/PHPCI/Plugin/PhpCodeSniffer.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,19 @@ namespace PHPCI\Plugin; use PHPCI; use PHPCI\Builder; use PHPCI\Model\Build; +use PHPCI\PluginInterface; +use PHPCI\PluginZeroConfigInterface; /** -* PHP Code Sniffer Plugin - Allows PHP Code Sniffer testing. -* @author Dan Cryer -* @package PHPCI -* @subpackage Plugins -*/ -class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin + * PHP Code Sniffer Plugin + * + * Allows PHP Code Sniffer testing. + * + * @author Dan Cryer + * @package PHPCI + * @subpackage Plugins + */ +class PhpCodeSniffer implements PluginInterface, PluginZeroConfigInterface { /** * @var \PHPCI\Builder @@ -73,11 +78,7 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin protected $ignore; /** - * Check if this plugin can be executed. - * @param $stage - * @param Builder $builder - * @param Build $build - * @return bool + * {@inheritDocs} */ public static function canExecute($stage, Builder $builder, Build $build) { @@ -129,6 +130,7 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Handle this plugin's options. + * * @param $options */ protected function setOptions($options) @@ -141,8 +143,8 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } /** - * Runs PHP Code Sniffer in a specified directory, to a specified standard. - */ + * {@inheritDocs} + */ public function execute() { list($ignore, $standard, $suffixes) = $this->getFlags(); @@ -185,6 +187,7 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Process options and produce an arguments string for PHPCS. + * * @return array */ protected function getFlags() @@ -210,8 +213,11 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Process the PHPCS output report. + * * @param $output + * * @return array + * * @throws \Exception */ protected function processReport($output) diff --git a/PHPCI/Plugin/PhpCpd.php b/PHPCI/Plugin/PhpCpd.php index 6433308f..5ced2016 100644 --- a/PHPCI/Plugin/PhpCpd.php +++ b/PHPCI/Plugin/PhpCpd.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,18 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Helper\Lang; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** -* PHP Copy / Paste Detector - Allows PHP Copy / Paste Detector testing. -* @author Dan Cryer -* @package PHPCI -* @subpackage Plugins -*/ -class PhpCpd implements \PHPCI\Plugin + * PHP Copy / Paste Detector. + * + * Allows PHP Copy / Paste Detector testing. + * + * @author Dan Cryer + * @package PHPCI + * @subpackage Plugins + */ +class PhpCpd implements PluginInterface { protected $directory; protected $args; @@ -39,6 +43,7 @@ class PhpCpd implements \PHPCI\Plugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param array $options @@ -66,8 +71,8 @@ class PhpCpd implements \PHPCI\Plugin } /** - * Runs PHP Copy/Paste Detector in a specified directory. - */ + * {@inheritDocs} + */ public function execute() { $ignore = ''; @@ -108,8 +113,11 @@ class PhpCpd implements \PHPCI\Plugin /** * Process the PHPCPD XML report. + * * @param $xmlString + * * @return array + * * @throws \Exception */ protected function processReport($xmlString) diff --git a/PHPCI/Plugin/PhpCsFixer.php b/PHPCI/Plugin/PhpCsFixer.php index e07db718..909b0b97 100644 --- a/PHPCI/Plugin/PhpCsFixer.php +++ b/PHPCI/Plugin/PhpCsFixer.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,18 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Helper\Lang; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** -* PHP CS Fixer - Works with the PHP CS Fixer for testing coding standards. -* @author Gabriel Baker -* @package PHPCI -* @subpackage Plugins -*/ -class PhpCsFixer implements \PHPCI\Plugin + * PHP CS Fixer + * + * Works with the PHP CS Fixer for testing coding standards. + * + * @author Gabriel Baker + * @package PHPCI + * @subpackage Plugins + */ +class PhpCsFixer implements PluginInterface { /** * @var \PHPCI\Builder @@ -59,8 +63,7 @@ class PhpCsFixer implements \PHPCI\Plugin } /** - * Run PHP CS Fixer. - * @return bool + * {@inheritDocs} */ public function execute() { @@ -79,6 +82,7 @@ class PhpCsFixer implements \PHPCI\Plugin /** * Build an args string for PHPCS Fixer. + * * @param $options */ public function buildArgs($options) @@ -98,6 +102,5 @@ class PhpCsFixer implements \PHPCI\Plugin if (isset($options['workingdir']) && $options['workingdir']) { $this->workingdir = $this->phpci->buildPath . $options['workingdir']; } - } } diff --git a/PHPCI/Plugin/PhpDocblockChecker.php b/PHPCI/Plugin/PhpDocblockChecker.php index 7fb0fe11..c509715a 100644 --- a/PHPCI/Plugin/PhpDocblockChecker.php +++ b/PHPCI/Plugin/PhpDocblockChecker.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,19 @@ namespace PHPCI\Plugin; use PHPCI; use PHPCI\Builder; use PHPCI\Model\Build; +use PHPCI\PluginInterface; +use PHPCI\PluginZeroConfigInterface; /** -* PHP Docblock Checker Plugin - Checks your PHP files for appropriate uses of Docblocks -* @author Dan Cryer -* @package PHPCI -* @subpackage Plugins -*/ -class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin + * PHP Docblock Checker Plugin + * + * Checks your PHP files for appropriate uses of Docblocks. + * + * @author Dan Cryer + * @package PHPCI + * @subpackage Plugins + */ +class PhpDocblockChecker implements PluginInterface, PluginZeroConfigInterface { /** * @var \PHPCI\Builder @@ -46,11 +51,7 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin protected $skipMethods = false; /** - * Check if this plugin can be executed. - * @param $stage - * @param Builder $builder - * @param Build $build - * @return bool + * {@inheritDocs} */ public static function canExecute($stage, Builder $builder, Build $build) { @@ -63,6 +64,7 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param array $options @@ -97,7 +99,7 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } /** - * Runs PHP Mess Detector in a specified directory. + * {@inheritDocs} */ public function execute() { @@ -155,6 +157,7 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Report all of the errors we've encountered line-by-line. + * * @param $output */ protected function reportErrors($output) diff --git a/PHPCI/Plugin/PhpLoc.php b/PHPCI/Plugin/PhpLoc.php index 76887493..760be3c2 100644 --- a/PHPCI/Plugin/PhpLoc.php +++ b/PHPCI/Plugin/PhpLoc.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,30 +12,30 @@ namespace PHPCI\Plugin; use PHPCI; use PHPCI\Builder; use PHPCI\Model\Build; +use PHPCI\PluginInterface; +use PHPCI\PluginZeroConfigInterface; /** * PHP Loc - Allows PHP Copy / Lines of Code testing. + * * @author Johan van der Heide * @package PHPCI * @subpackage Plugins */ -class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin +class PhpLoc implements PluginInterface, PluginZeroConfigInterface { /** * @var string */ protected $directory; + /** * @var \PHPCI\Builder */ protected $phpci; /** - * Check if this plugin can be executed. - * @param $stage - * @param Builder $builder - * @param Build $build - * @return bool + * {@inheritDocs} */ public static function canExecute($stage, Builder $builder, Build $build) { @@ -48,6 +48,7 @@ class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param array $options @@ -64,7 +65,7 @@ class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } /** - * Runs PHP Copy/Paste Detector in a specified directory. + * {@inheritDocs} */ public function execute() { diff --git a/PHPCI/Plugin/PhpMessDetector.php b/PHPCI/Plugin/PhpMessDetector.php index b02f5f09..0cdbc1c1 100644 --- a/PHPCI/Plugin/PhpMessDetector.php +++ b/PHPCI/Plugin/PhpMessDetector.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,17 @@ namespace PHPCI\Plugin; use PHPCI; use PHPCI\Builder; use PHPCI\Model\Build; +use PHPCI\PluginInterface; +use PHPCI\PluginZeroConfigInterface; /** -* PHP Mess Detector Plugin - Allows PHP Mess Detector testing. -* @author Dan Cryer -* @package PHPCI -* @subpackage Plugins -*/ -class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin + * PHP Mess Detector Plugin - Allows PHP Mess Detector testing. + * + * @author Dan Cryer + * @package PHPCI + * @subpackage Plugins + */ +class PhpMessDetector implements PluginInterface, PluginZeroConfigInterface { /** * @var \PHPCI\Builder @@ -56,11 +59,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin protected $rules; /** - * Check if this plugin can be executed. - * @param $stage - * @param Builder $builder - * @param Build $build - * @return bool + * {@inheritDocs} */ public static function canExecute($stage, Builder $builder, Build $build) { @@ -111,7 +110,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } /** - * Runs PHP Mess Detector in a specified directory. + * {@inheritDocs} */ public function execute() { @@ -132,6 +131,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Override a default setting. + * * @param $options * @param $key */ @@ -144,8 +144,11 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Process PHPMD's XML output report. + * * @param $xmlString + * * @return array + * * @throws \Exception */ protected function processReport($xmlString) @@ -186,6 +189,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Try and process the rules parameter from phpci.yml. + * * @return bool */ protected function tryAndProcessRules() @@ -206,6 +210,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Execute PHP Mess Detector. + * * @param $binaryPath */ protected function executePhpMd($binaryPath) @@ -242,6 +247,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Get the path PHPMD should be run against. + * * @return string */ protected function getTargetPath() @@ -258,6 +264,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin * Returns a boolean indicating if the error count can be considered a success. * * @param int $errorCount + * * @return bool */ protected function wasLastExecSuccessful($errorCount) diff --git a/PHPCI/Plugin/PhpParallelLint.php b/PHPCI/Plugin/PhpParallelLint.php index 8b7528de..345565cd 100644 --- a/PHPCI/Plugin/PhpParallelLint.php +++ b/PHPCI/Plugin/PhpParallelLint.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,16 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Helper\Lang; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** -* Php Parallel Lint Plugin - Provides access to PHP lint functionality. -* @author Vaclav Makes -* @package PHPCI -* @subpackage Plugins -*/ -class PhpParallelLint implements \PHPCI\Plugin + * Php Parallel Lint Plugin - Provides access to PHP lint functionality. + * + * @author Vaclav Makes + * @package PHPCI + * @subpackage Plugins + */ +class PhpParallelLint implements PluginInterface { /** * @var \PHPCI\Builder @@ -70,8 +72,8 @@ class PhpParallelLint implements \PHPCI\Plugin } /** - * Executes parallel lint - */ + * {@inheritDocs} + */ public function execute() { list($ignore) = $this->getFlags(); @@ -97,6 +99,7 @@ class PhpParallelLint implements \PHPCI\Plugin /** * Produce an argument string for PHP Parallel Lint. + * * @return array */ protected function getFlags() diff --git a/PHPCI/Plugin/PhpSpec.php b/PHPCI/Plugin/PhpSpec.php index e468a718..551cf56a 100644 --- a/PHPCI/Plugin/PhpSpec.php +++ b/PHPCI/Plugin/PhpSpec.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,22 +12,24 @@ namespace PHPCI\Plugin; use PHPCI; use PHPCI\Builder; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** -* PHP Spec Plugin - Allows PHP Spec testing. -* @author Dan Cryer -* @package PHPCI -* @subpackage Plugins -*/ -class PhpSpec implements PHPCI\Plugin + * PHP Spec Plugin - Allows PHP Spec testing. + * + * @author Dan Cryer + * @package PHPCI + * @subpackage Plugins + */ +class PhpSpec implements PluginInterface { /** - * @var \PHPCI\Builder + * @var Builder */ protected $phpci; /** - * @var \PHPCI\Model\Build + * @var Build */ protected $build; @@ -38,6 +40,7 @@ class PhpSpec implements PHPCI\Plugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param array $options @@ -50,8 +53,8 @@ class PhpSpec implements PHPCI\Plugin } /** - * Runs PHP Spec tests. - */ + * {@inheritDocs} + */ public function execute() { $curdir = getcwd(); @@ -143,7 +146,6 @@ class PhpSpec implements PHPCI\Plugin $this->build->storeMeta('phpspec', $data); - return $success; } } diff --git a/PHPCI/Plugin/PhpTalLint.php b/PHPCI/Plugin/PhpTalLint.php index e12b6c34..c8721ed0 100644 --- a/PHPCI/Plugin/PhpTalLint.php +++ b/PHPCI/Plugin/PhpTalLint.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,16 @@ namespace PHPCI\Plugin; use PHPCI; use PHPCI\Builder; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** * PHPTAL Lint Plugin - Provides access to PHPTAL lint functionality. + * * @author Stephen Ball * @package PHPCI * @subpackage Plugins */ -class PhpTalLint implements PHPCI\Plugin +class PhpTalLint implements PluginInterface { protected $directories; protected $recursive = true; @@ -27,12 +29,12 @@ class PhpTalLint implements PHPCI\Plugin protected $ignore; /** - * @var \PHPCI\Builder + * @var Builder */ protected $phpci; /** - * @var \PHPCI\Model\Build + * @var Build */ protected $build; @@ -87,6 +89,7 @@ class PhpTalLint implements PHPCI\Plugin /** * Handle this plugin's options. + * * @param $options */ protected function setOptions($options) @@ -99,7 +102,7 @@ class PhpTalLint implements PHPCI\Plugin } /** - * Executes phptal lint + * {@inheritDocs} */ public function execute() { @@ -143,8 +146,10 @@ class PhpTalLint implements PHPCI\Plugin /** * Lint an item (file or directory) by calling the appropriate method. + * * @param $item * @param $itemPath + * * @return bool */ protected function lintItem($item, $itemPath) @@ -164,7 +169,9 @@ class PhpTalLint implements PHPCI\Plugin /** * Run phptal lint against a directory of files. + * * @param $path + * * @return bool */ protected function lintDirectory($path) @@ -193,7 +200,9 @@ class PhpTalLint implements PHPCI\Plugin /** * Run phptal lint against a specific file. + * * @param $path + * * @return bool */ protected function lintFile($path) @@ -222,7 +231,7 @@ class PhpTalLint implements PHPCI\Plugin $row = str_replace('(use -i to include your custom modifier functions)', '', $row); $message = str_replace($name . ': ', '', $row); - + $parts = explode(' (line ', $message); $message = trim($parts[0]); @@ -244,6 +253,7 @@ class PhpTalLint implements PHPCI\Plugin /** * Process options and produce an arguments string for PHPTAL Lint. + * * @return array */ protected function getFlags() diff --git a/PHPCI/Plugin/PhpUnit.php b/PHPCI/Plugin/PhpUnit.php index 7fb626df..4b949dac 100644 --- a/PHPCI/Plugin/PhpUnit.php +++ b/PHPCI/Plugin/PhpUnit.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -13,14 +13,17 @@ use PHPCI; use PHPCI\Builder; use PHPCI\Model\Build; use PHPCI\Plugin\Util\TapParser; +use PHPCI\PluginInterface; +use PHPCI\PluginZeroConfigInterface; /** -* PHP Unit Plugin - Allows PHP Unit testing. -* @author Dan Cryer -* @package PHPCI -* @subpackage Plugins -*/ -class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin + * PHP Unit Plugin - Allows PHP Unit testing. + * + * @author Dan Cryer + * @package PHPCI + * @subpackage Plugins + */ +class PhpUnit implements PluginInterface, PluginZeroConfigInterface { protected $args; protected $phpci; @@ -50,11 +53,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin protected $xmlConfigFile; /** - * Check if this plugin can be executed. - * @param $stage - * @param Builder $builder - * @param Build $build - * @return bool + * {@inheritDocs} */ public static function canExecute($stage, Builder $builder, Build $build) { @@ -67,7 +66,9 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Try and find the phpunit XML config file. + * * @param $buildPath + * * @return null|string */ public static function findConfigFile($buildPath) @@ -138,8 +139,8 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } /** - * Runs PHP Unit tests in a specified directory, optionally using specified config file(s). - */ + * {@inheritDocs} + */ public function execute() { if (empty($this->xmlConfigFile) && empty($this->directory)) { @@ -184,7 +185,9 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Run the tests defined in a PHPUnit config file. + * * @param $configPath + * * @return bool|mixed */ protected function runConfigFile($configPath) @@ -212,7 +215,9 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Run the PHPUnit tests in a specific directory or array of directories. + * * @param $directory + * * @return bool|mixed */ protected function runDir($directory) @@ -235,6 +240,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * @param $array * @param $callable + * * @return bool|mixed */ protected function recurseArg($array, $callable) diff --git a/PHPCI/Plugin/Shell.php b/PHPCI/Plugin/Shell.php index 5e914f3e..51562657 100644 --- a/PHPCI/Plugin/Shell.php +++ b/PHPCI/Plugin/Shell.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,16 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Helper\Lang; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** * Shell Plugin - Allows execute shell commands. + * * @author Kinn Coelho Julião * @package PHPCI * @subpackage Plugins */ -class Shell implements \PHPCI\Plugin +class Shell implements PluginInterface { /** * @var \PHPCI\Builder @@ -75,7 +77,7 @@ class Shell implements \PHPCI\Plugin } /** - * Runs the shell command. + * {@inheritDocs} */ public function execute() { diff --git a/PHPCI/Plugin/SlackNotify.php b/PHPCI/Plugin/SlackNotify.php index 65a190fd..a4634aa8 100644 --- a/PHPCI/Plugin/SlackNotify.php +++ b/PHPCI/Plugin/SlackNotify.php @@ -1,7 +1,8 @@ * @package PHPCI * @subpackage Plugins */ -class SlackNotify implements \PHPCI\Plugin +class SlackNotify implements PluginInterface { private $webHook; private $room; @@ -69,8 +72,7 @@ class SlackNotify implements \PHPCI\Plugin } /** - * Run the Slack plugin. - * @return bool + * {@inheritDocs} */ public function execute() { diff --git a/PHPCI/Plugin/Sqlite.php b/PHPCI/Plugin/Sqlite.php index f80ece3d..1daa05d5 100644 --- a/PHPCI/Plugin/Sqlite.php +++ b/PHPCI/Plugin/Sqlite.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,14 +12,16 @@ namespace PHPCI\Plugin; use PDO; use PHPCI\Builder; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** -* SQLite Plugin — Provides access to a SQLite database. -* @author Corpsee -* @package PHPCI -* @subpackage Plugins -*/ -class Sqlite implements \PHPCI\Plugin + * SQLite Plugin — Provides access to a SQLite database. + * + * @author Corpsee + * @package PHPCI + * @subpackage Plugins + */ +class Sqlite implements PluginInterface { /** * @var \PHPCI\Builder @@ -60,8 +62,7 @@ class Sqlite implements \PHPCI\Plugin } /** - * Connects to SQLite and runs a specified set of queries. - * @return boolean + * {@inheritDocs} */ public function execute() { diff --git a/PHPCI/Plugin/TechnicalDebt.php b/PHPCI/Plugin/TechnicalDebt.php index eca05213..b93dfee0 100755 --- a/PHPCI/Plugin/TechnicalDebt.php +++ b/PHPCI/Plugin/TechnicalDebt.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -12,15 +12,17 @@ namespace PHPCI\Plugin; use PHPCI; use PHPCI\Builder; use PHPCI\Model\Build; +use PHPCI\PluginInterface; +use PHPCI\PluginZeroConfigInterface; /** -* Technical Debt Plugin - Checks for existence of "TODO", "FIXME", etc. -* -* @author James Inman -* @package PHPCI -* @subpackage Plugins -*/ -class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin + * Technical Debt Plugin - Checks for existence of "TODO", "FIXME", etc. + * + * @author James Inman + * @package PHPCI + * @subpackage Plugins + */ +class TechnicalDebt implements PluginInterface, PluginZeroConfigInterface { /** * @var \PHPCI\Builder @@ -65,12 +67,7 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** - * Check if this plugin can be executed. - * - * @param $stage - * @param Builder $builder - * @param Build $build - * @return bool + * {@inheritDocs} */ public static function canExecute($stage, Builder $builder, Build $build) { @@ -110,6 +107,7 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin /** * Handle this plugin's options. + * * @param $options */ protected function setOptions($options) @@ -122,8 +120,8 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } /** - * Runs the plugin - */ + * {@inheritDocs} + */ public function execute() { $success = true; diff --git a/PHPCI/Plugin/Wipe.php b/PHPCI/Plugin/Wipe.php index 86e543b5..34845436 100644 --- a/PHPCI/Plugin/Wipe.php +++ b/PHPCI/Plugin/Wipe.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -11,14 +11,16 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** -* Wipe Plugin - Wipes a folder -* @author Claus Due -* @package PHPCI -* @subpackage Plugins -*/ -class Wipe implements \PHPCI\Plugin + * Wipe Plugin - Wipes a folder + * + * @author Claus Due + * @package PHPCI + * @subpackage Plugins + */ +class Wipe implements PluginInterface { /** * @var \PHPCI\Builder @@ -34,6 +36,7 @@ class Wipe implements \PHPCI\Plugin /** * Set up the plugin, configure options, etc. + * * @param Builder $phpci * @param Build $build * @param array $options @@ -47,8 +50,8 @@ class Wipe implements \PHPCI\Plugin } /** - * Wipes a directory's contents - */ + * {@inheritDocs} + */ public function execute() { $build = $this->phpci->buildPath; diff --git a/PHPCI/Plugin/Xmpp.php b/PHPCI/Plugin/Xmpp.php index 0362aa85..845c38dc 100644 --- a/PHPCI/Plugin/Xmpp.php +++ b/PHPCI/Plugin/Xmpp.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -11,14 +11,16 @@ namespace PHPCI\Plugin; use PHPCI\Builder; use PHPCI\Model\Build; +use PHPCI\PluginInterface; /** -* XMPP Notification - Send notification for successful or failure build -* @author Alexandre Russo -* @package PHPCI -* @subpackage Plugins -*/ -class XMPP implements \PHPCI\Plugin + * XMPP Notification - Send notification for successful or failure build + * + * @author Alexandre Russo + * @package PHPCI + * @subpackage Plugins + */ +class XMPP implements PluginInterface { protected $directory; protected $phpci; @@ -129,6 +131,8 @@ class XMPP implements \PHPCI\Plugin /** * Find config file for sendxmpp binary (default is .sendxmpprc) + * + * @return bool|null */ public function findConfigFile() { @@ -144,8 +148,8 @@ class XMPP implements \PHPCI\Plugin } /** - * Send notification message. - */ + * {@inheritDocs} + */ public function execute() { $sendxmpp = $this->phpci->findBinary('sendxmpp'); @@ -199,6 +203,7 @@ class XMPP implements \PHPCI\Plugin /** * @param $message_file + * * @return int */ protected function buildMessage($message_file) diff --git a/PHPCI/PluginInterface.php b/PHPCI/PluginInterface.php new file mode 100644 index 00000000..2368545b --- /dev/null +++ b/PHPCI/PluginInterface.php @@ -0,0 +1,32 @@ + + */ +interface PluginInterface +{ + /** + * Exeucte the plugin and return the execution success result. + * + * @return bool Plugin execution status result. + * @throws PluginException + * @throws PluginBinaryNotFoundException + */ + public function execute(); +} diff --git a/PHPCI/PluginZeroConfigInterface.php b/PHPCI/PluginZeroConfigInterface.php new file mode 100644 index 00000000..767f04a7 --- /dev/null +++ b/PHPCI/PluginZeroConfigInterface.php @@ -0,0 +1,30 @@ + + */ +interface PluginZeroConfigInterface +{ + /** + * Check if this plugin can be executed. + * + * @param string $stage The current stage + * @param Builder $builder The plugin builder + * @param Build $build The current build + * @return bool Plugin execution result status. + */ + public static function canExecute($stage, Builder $builder, Build $build); +} diff --git a/PHPCI/ZeroConfigPlugin.php b/PHPCI/ZeroConfigPlugin.php index 73f7746c..410ee37e 100644 --- a/PHPCI/ZeroConfigPlugin.php +++ b/PHPCI/ZeroConfigPlugin.php @@ -2,7 +2,7 @@ /** * PHPCI - Continuous Integration for PHP * - * @copyright Copyright 2014, Block 8 Limited. + * @copyright Copyright 2015, Block 8 Limited. * @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md * @link https://www.phptesting.org/ */ @@ -13,9 +13,12 @@ use PHPCI\Model\Build; /** * PHPCI Plugin Interface - Used by all build plugins. - * @author Dan Cryer + * + * @author Dan Cryer + * @deprecated 1.8 Only for backward compatibility + * @see PluginZeroConfigInterface */ -interface ZeroConfigPlugin +interface ZeroConfigPlugin extends PluginZeroConfigInterface { - public static function canExecute($stage, Builder $builder, Build $build); + }