diff --git a/LICENSE.md b/LICENSE.md index 1df52b9c..4c4f6952 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -6,4 +6,4 @@ Redistribution and use in source and binary forms, with or without modification, - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/PHPCI/Application.php b/PHPCI/Application.php index a8790804..ee1f6e15 100644 --- a/PHPCI/Application.php +++ b/PHPCI/Application.php @@ -14,7 +14,6 @@ use b8\Exception\HttpException; use b8\Http\Response; use b8\Http\Response\RedirectResponse; use b8\View; -use PHPCI\Model\Build; /** * PHPCI Front Controller @@ -58,7 +57,7 @@ class Application extends b8\Application $routeHandler = function (&$route, Response &$response) use (&$request, $validateSession, $skipAuth) { $skipValidation = in_array($route['controller'], array('session', 'webhook', 'build-status')); - if (!$skipValidation && !$validateSession() && !$skipAuth()) { + if (!$skipValidation && !$validateSession() && (!is_callable($skipAuth) || !$skipAuth())) { if ($request->isAjax()) { $response->setResponseCode(401); $response->setContent(''); diff --git a/PHPCI/Command/CreateAdminCommand.php b/PHPCI/Command/CreateAdminCommand.php index 81f23c72..3b69afd3 100644 --- a/PHPCI/Command/CreateAdminCommand.php +++ b/PHPCI/Command/CreateAdminCommand.php @@ -12,12 +12,9 @@ namespace PHPCI\Command; use PHPCI\Helper\Lang; use PHPCI\Service\UserService; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use b8\Store\Factory; -use PHPCI\Builder; /** * Create admin command - creates an admin user @@ -77,7 +74,7 @@ class CreateAdminCommand extends Command if (!$emptyOk && empty($rtn)) { $rtn = $this->ask($question, $emptyOk, $validationFilter); - } elseif ($validationFilter != null && ! empty($rtn)) { + } elseif (!is_null($validationFilter) && ! empty($rtn)) { if (! $this -> controlFormat($rtn, $validationFilter, $statusMessage)) { print $statusMessage; $rtn = $this->ask($question, $emptyOk, $validationFilter); diff --git a/PHPCI/Command/DaemonCommand.php b/PHPCI/Command/DaemonCommand.php index 79925fbd..e51f31f1 100644 --- a/PHPCI/Command/DaemonCommand.php +++ b/PHPCI/Command/DaemonCommand.php @@ -12,13 +12,8 @@ namespace PHPCI\Command; use Monolog\Logger; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use b8\Store\Factory; -use PHPCI\Builder; -use PHPCI\BuildFactory; /** * Daemon that loops and call the run-command. diff --git a/PHPCI/Command/DaemoniseCommand.php b/PHPCI/Command/DaemoniseCommand.php index 0bcd42f6..eadd334e 100644 --- a/PHPCI/Command/DaemoniseCommand.php +++ b/PHPCI/Command/DaemoniseCommand.php @@ -12,9 +12,7 @@ namespace PHPCI\Command; use Monolog\Logger; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\ArgvInput; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; /** @@ -76,7 +74,7 @@ class DaemoniseCommand extends Command $this->sleep = 0; $runner = new RunCommand($this->logger); $runner->setMaxBuilds(1); - $runner->setIsDaemon(true); + $runner->setDaemon(true); $emptyInput = new ArgvInput(array()); diff --git a/PHPCI/Command/GenerateCommand.php b/PHPCI/Command/GenerateCommand.php index 07307686..ddd227d9 100644 --- a/PHPCI/Command/GenerateCommand.php +++ b/PHPCI/Command/GenerateCommand.php @@ -10,9 +10,7 @@ namespace PHPCI\Command; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use b8\Database; use b8\Database\CodeGenerator; diff --git a/PHPCI/Command/InstallCommand.php b/PHPCI/Command/InstallCommand.php index 77b6b962..2917303d 100644 --- a/PHPCI/Command/InstallCommand.php +++ b/PHPCI/Command/InstallCommand.php @@ -17,11 +17,9 @@ use b8\Database; use b8\Store\Factory; use PHPCI\Helper\Lang; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Helper\DialogHelper; use PHPCI\Service\UserService; /** @@ -298,6 +296,8 @@ class InstallCommand extends Command ) ); + unset($pdo); + return true; } catch (Exception $ex) { diff --git a/PHPCI/Command/PollCommand.php b/PHPCI/Command/PollCommand.php index 42a07067..a8729515 100644 --- a/PHPCI/Command/PollCommand.php +++ b/PHPCI/Command/PollCommand.php @@ -14,9 +14,7 @@ use b8\HttpClient; use Monolog\Logger; use PHPCI\Helper\Lang; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Yaml\Parser; use PHPCI\Model\Build; diff --git a/PHPCI/Command/RunCommand.php b/PHPCI/Command/RunCommand.php index 63e38b2d..0cbd8e6a 100644 --- a/PHPCI/Command/RunCommand.php +++ b/PHPCI/Command/RunCommand.php @@ -15,11 +15,8 @@ use PHPCI\Helper\Lang; use PHPCI\Logging\BuildDBLogHandler; use PHPCI\Logging\LoggedBuildContextTidier; use PHPCI\Logging\OutputLogHandler; -use Psr\Log\LoggerAwareInterface; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use b8\Store\Factory; use PHPCI\Builder; @@ -143,7 +140,7 @@ class RunCommand extends Command $this->maxBuilds = (int)$numBuilds; } - public function setIsDaemon($fromDaemon) + public function setDaemon($fromDaemon) { $this->isFromDaemon = (bool)$fromDaemon; } diff --git a/PHPCI/Command/UpdateCommand.php b/PHPCI/Command/UpdateCommand.php index 1ca1341d..8170675a 100644 --- a/PHPCI/Command/UpdateCommand.php +++ b/PHPCI/Command/UpdateCommand.php @@ -12,10 +12,7 @@ namespace PHPCI\Command; use Monolog\Logger; use PHPCI\Helper\Lang; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; /** diff --git a/PHPCI/Controller/PluginController.php b/PHPCI/Controller/PluginController.php index a090798e..20675e46 100644 --- a/PHPCI/Controller/PluginController.php +++ b/PHPCI/Controller/PluginController.php @@ -11,7 +11,6 @@ namespace PHPCI\Controller; use b8; use PHPCI\Helper\Lang; -use PHPCI\Model\Build; use PHPCI\Plugin\Util\ComposerPluginInformation; use PHPCI\Plugin\Util\FilesPluginInformation; use PHPCI\Plugin\Util\PluginInformationCollection; diff --git a/PHPCI/Controller/ProjectController.php b/PHPCI/Controller/ProjectController.php index e1aaa6cb..a626100b 100644 --- a/PHPCI/Controller/ProjectController.php +++ b/PHPCI/Controller/ProjectController.php @@ -10,17 +10,14 @@ namespace PHPCI\Controller; use b8; -use b8\Controller; use b8\Form; -use b8\Exception\HttpException\ForbiddenException; use b8\Exception\HttpException\NotFoundException; use b8\Store; +use PHPCI; use PHPCI\BuildFactory; use PHPCI\Helper\Github; use PHPCI\Helper\Lang; use PHPCI\Helper\SshKey; -use PHPCI\Model\Build; -use PHPCI\Model\Project; use PHPCI\Service\BuildService; use PHPCI\Service\ProjectService; @@ -30,7 +27,7 @@ use PHPCI\Service\ProjectService; * @package PHPCI * @subpackage Web */ -class ProjectController extends \PHPCI\Controller +class ProjectController extends Controller { /** * @var \PHPCI\Store\ProjectStore diff --git a/PHPCI/Controller/SettingsController.php b/PHPCI/Controller/SettingsController.php index ba9b0141..3c5ab5f4 100644 --- a/PHPCI/Controller/SettingsController.php +++ b/PHPCI/Controller/SettingsController.php @@ -14,7 +14,6 @@ use b8\Form; use b8\HttpClient; use PHPCI\Controller; use PHPCI\Helper\Lang; -use PHPCI\Model\Build; use Symfony\Component\Yaml\Dumper; use Symfony\Component\Yaml\Parser; diff --git a/PHPCI/Controller/UserController.php b/PHPCI/Controller/UserController.php index 48092ad5..8d09ecd0 100644 --- a/PHPCI/Controller/UserController.php +++ b/PHPCI/Controller/UserController.php @@ -10,12 +10,10 @@ namespace PHPCI\Controller; use b8; -use b8\Exception\HttpException\ForbiddenException; use b8\Exception\HttpException\NotFoundException; use b8\Form; use PHPCI\Controller; use PHPCI\Helper\Lang; -use PHPCI\Model\User; use PHPCI\Service\UserService; /** diff --git a/PHPCI/Controller/WebhookController.php b/PHPCI/Controller/WebhookController.php index 5ce4849b..cef7dc53 100644 --- a/PHPCI/Controller/WebhookController.php +++ b/PHPCI/Controller/WebhookController.php @@ -12,7 +12,6 @@ namespace PHPCI\Controller; use b8; use b8\Store; use PHPCI\BuildFactory; -use PHPCI\Model\Build; use PHPCI\Service\BuildService; /** diff --git a/PHPCI/Helper/Email.php b/PHPCI/Helper/Email.php index 3ca15e94..cb588dd1 100644 --- a/PHPCI/Helper/Email.php +++ b/PHPCI/Helper/Email.php @@ -90,7 +90,7 @@ class Email * @param bool $isHtml * @return $this */ - public function setIsHtml($isHtml = false) + public function setHtml($isHtml = false) { $this->isHtml = $isHtml; diff --git a/PHPCI/Migrations/20140513153133_change_build_keys_migration.php b/PHPCI/Migrations/20140513153133_change_build_keys_migration.php index b26a9388..7fd253cc 100644 --- a/PHPCI/Migrations/20140513153133_change_build_keys_migration.php +++ b/PHPCI/Migrations/20140513153133_change_build_keys_migration.php @@ -23,4 +23,4 @@ class ChangeBuildKeysMigration extends AbstractMigration $project->renameColumn('ssh_private_key', 'git_key'); $project->renameColumn('ssh_public_key', 'public_key'); } -} \ No newline at end of file +} diff --git a/PHPCI/Migrations/20140611170618_choose_branch.php b/PHPCI/Migrations/20140611170618_choose_branch.php index 5945c241..26b4ed4c 100644 --- a/PHPCI/Migrations/20140611170618_choose_branch.php +++ b/PHPCI/Migrations/20140611170618_choose_branch.php @@ -37,4 +37,4 @@ class ChooseBranch extends AbstractMigration $project = $this->table('project'); $project->removeColumn('branch')->save(); } -} \ No newline at end of file +} diff --git a/PHPCI/Migrations/20150203105015_fix_column_types.php b/PHPCI/Migrations/20150203105015_fix_column_types.php index 9a693594..f9bcf68a 100644 --- a/PHPCI/Migrations/20150203105015_fix_column_types.php +++ b/PHPCI/Migrations/20150203105015_fix_column_types.php @@ -25,4 +25,4 @@ class FixColumnTypes extends AbstractMigration 'limit' => MysqlAdapter::TEXT_MEDIUM, )); } -} \ No newline at end of file +} diff --git a/PHPCI/Plugin.php b/PHPCI/Plugin.php index 67914b7d..ac2960cd 100644 --- a/PHPCI/Plugin.php +++ b/PHPCI/Plugin.php @@ -9,8 +9,6 @@ namespace PHPCI; -use PHPCI\Model\Build; - /** * PHPCI Plugin Interface - Used by all build plugins. * @author Dan Cryer diff --git a/PHPCI/Plugin/Campfire.php b/PHPCI/Plugin/Campfire.php index b111786e..325e6e40 100644 --- a/PHPCI/Plugin/Campfire.php +++ b/PHPCI/Plugin/Campfire.php @@ -148,7 +148,6 @@ class Campfire implements \PHPCI\Plugin return json_decode($output); } // Simple 200 OK response (such as for joining a room) - // TODO: check for other result codes here return true; } } diff --git a/PHPCI/Plugin/CopyBuild.php b/PHPCI/Plugin/CopyBuild.php index a80819fb..7f447291 100644 --- a/PHPCI/Plugin/CopyBuild.php +++ b/PHPCI/Plugin/CopyBuild.php @@ -74,7 +74,7 @@ class CopyBuild implements \PHPCI\Plugin */ protected function wipeExistingDirectory() { - if ($this->wipe == true && $this->directory != '/' && is_dir($this->directory)) { + if ($this->wipe === true && $this->directory != '/' && is_dir($this->directory)) { $cmd = 'rm -Rf "%s*"'; $success = $this->phpci->executeCommand($cmd, $this->directory); diff --git a/PHPCI/Plugin/HipchatNotify.php b/PHPCI/Plugin/HipchatNotify.php index 0cc1bf70..a39b94fe 100644 --- a/PHPCI/Plugin/HipchatNotify.php +++ b/PHPCI/Plugin/HipchatNotify.php @@ -21,11 +21,9 @@ use PHPCI\Model\Build; */ class HipchatNotify implements \PHPCI\Plugin { - private $authToken; - private $userAgent; - private $cookie; - private $color; - private $notify; + protected $authToken; + protected $color; + protected $notify; /** * Set up the plugin, configure options, etc. diff --git a/PHPCI/Plugin/Util/ComposerPluginInformation.php b/PHPCI/Plugin/Util/ComposerPluginInformation.php index 1f022b4a..d8dcc91f 100644 --- a/PHPCI/Plugin/Util/ComposerPluginInformation.php +++ b/PHPCI/Plugin/Util/ComposerPluginInformation.php @@ -2,6 +2,8 @@ namespace PHPCI\Plugin\Util; +use PHPCI\Plugin; + /** * Class ComposerPluginInformation * @package PHPCI\Plugin\Util @@ -63,7 +65,7 @@ class ComposerPluginInformation implements InstalledPluginInformation public function getPluginClasses() { return array_map( - function ($plugin) { + function (Plugin $plugin) { return $plugin->class; }, $this->getInstalledPlugins() diff --git a/PHPCI/Plugin/Util/FilesPluginInformation.php b/PHPCI/Plugin/Util/FilesPluginInformation.php index 6bad028f..33b3e4b3 100644 --- a/PHPCI/Plugin/Util/FilesPluginInformation.php +++ b/PHPCI/Plugin/Util/FilesPluginInformation.php @@ -2,6 +2,8 @@ namespace PHPCI\Plugin\Util; +use PHPCI\Plugin; + /** * Class FilesPluginInformation * @package PHPCI\Plugin\Util @@ -66,7 +68,7 @@ class FilesPluginInformation implements InstalledPluginInformation public function getPluginClasses() { return array_map( - function ($plugin) { + function (Plugin $plugin) { return $plugin->class; }, $this->getInstalledPlugins() @@ -114,8 +116,6 @@ class FilesPluginInformation implements InstalledPluginInformation */ protected function getFullClassFromFile(\SplFileInfo $fileInfo) { - //TODO: Something less horrible than a regular expression - // on the contents of a file $contents = file_get_contents($fileInfo->getRealPath()); $matches = array(); diff --git a/PHPCI/Store/BuildStore.php b/PHPCI/Store/BuildStore.php index 96631e1e..3a4c0ddc 100644 --- a/PHPCI/Store/BuildStore.php +++ b/PHPCI/Store/BuildStore.php @@ -10,7 +10,6 @@ namespace PHPCI\Store; use b8\Database; -use PHPCI\BuildFactory; use PHPCI\Model\Build; use PHPCI\Store\Base\BuildStoreBase; diff --git a/PHPCI/build/.gitignore b/PHPCI/build/.gitignore index c96a04f0..d6b7ef32 100644 --- a/PHPCI/build/.gitignore +++ b/PHPCI/build/.gitignore @@ -1,2 +1,2 @@ * -!.gitignore \ No newline at end of file +!.gitignore diff --git a/daemon/.gitignore b/daemon/.gitignore index c96a04f0..d6b7ef32 100644 --- a/daemon/.gitignore +++ b/daemon/.gitignore @@ -1,2 +1,2 @@ * -!.gitignore \ No newline at end of file +!.gitignore diff --git a/loggerconfig.php.example b/loggerconfig.php.example index c306673b..d5abc96e 100644 --- a/loggerconfig.php.example +++ b/loggerconfig.php.example @@ -13,4 +13,4 @@ return array( new \Monolog\Handler\RotatingFileHandler(__DIR__ . DIRECTORY_SEPARATOR . 'everything',3, \Monolog\Logger::DEBUG), ); }, -); \ No newline at end of file +); diff --git a/pluginconfig.php.example b/pluginconfig.php.example index 4e4279b9..5c182401 100644 --- a/pluginconfig.php.example +++ b/pluginconfig.php.example @@ -19,4 +19,4 @@ return function (PHPCI\Plugin\Util\Factory $factory) { // The resource will only be given when the type hint is: PHPCI\Plugin\Util\Factory::TYPE_ARRAY ); -}; \ No newline at end of file +};