Skip to content
Permalink
Browse files

Lots of cleanup.

  • Loading branch information...
Dan Cryer
Dan Cryer committed Feb 12, 2015
1 parent 5ca9d46 commit c20ca7c8ff546d8733dff9ff66053fe72150ba92
@@ -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.
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.
@@ -14,7 +14,6 @@
use b8\Http\Response;
use b8\Http\Response\RedirectResponse;
use b8\View;
use PHPCI\Model\Build;
/**
* PHPCI Front Controller
@@ -58,7 +57,7 @@ public function init()
$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('');
@@ -12,12 +12,9 @@
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 @@ protected function ask($question, $emptyOk = false, $validationFilter = null)
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);
@@ -12,13 +12,8 @@
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.
@@ -12,9 +12,7 @@
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 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->sleep = 0;
$runner = new RunCommand($this->logger);
$runner->setMaxBuilds(1);
$runner->setIsDaemon(true);
$runner->setDaemon(true);
$emptyInput = new ArgvInput(array());
@@ -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;
@@ -17,11 +17,9 @@
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 @@ protected function verifyDatabaseDetails(array $db, OutputInterface $output)
)
);
unset($pdo);
return true;
} catch (Exception $ex) {
@@ -14,9 +14,7 @@
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;
@@ -15,11 +15,8 @@
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 @@ public function setMaxBuilds($numBuilds)
$this->maxBuilds = (int)$numBuilds;
}
public function setIsDaemon($fromDaemon)
public function setDaemon($fromDaemon)
{
$this->isFromDaemon = (bool)$fromDaemon;
}
@@ -12,10 +12,7 @@
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;
/**
@@ -11,7 +11,6 @@
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;
@@ -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 @@
* @package PHPCI
* @subpackage Web
*/
class ProjectController extends \PHPCI\Controller
class ProjectController extends Controller
{
/**
* @var \PHPCI\Store\ProjectStore
@@ -14,7 +14,6 @@
use b8\HttpClient;
use PHPCI\Controller;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use Symfony\Component\Yaml\Dumper;
use Symfony\Component\Yaml\Parser;
@@ -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;
/**
@@ -12,7 +12,6 @@
use b8;
use b8\Store;
use PHPCI\BuildFactory;
use PHPCI\Model\Build;
use PHPCI\Service\BuildService;
/**
@@ -90,7 +90,7 @@ public function setBody($body)
* @param bool $isHtml
* @return $this
*/
public function setIsHtml($isHtml = false)
public function setHtml($isHtml = false)
{
$this->isHtml = $isHtml;
@@ -23,4 +23,4 @@ public function down()
$project->renameColumn('ssh_private_key', 'git_key');
$project->renameColumn('ssh_public_key', 'public_key');
}
}
}
@@ -37,4 +37,4 @@ public function down()
$project = $this->table('project');
$project->removeColumn('branch')->save();
}
}
}
@@ -25,4 +25,4 @@ public function up()
'limit' => MysqlAdapter::TEXT_MEDIUM,
));
}
}
}
@@ -9,8 +9,6 @@
namespace PHPCI;
use PHPCI\Model\Build;
/**
* PHPCI Plugin Interface - Used by all build plugins.
* @author Dan Cryer <dan@block8.co.uk>
@@ -148,7 +148,6 @@ private function getPageByPost($page, $data = null)
return json_decode($output);
}
// Simple 200 OK response (such as for joining a room)
// TODO: check for other result codes here
return true;
}
}
@@ -74,7 +74,7 @@ public function execute()
*/
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);
@@ -21,11 +21,9 @@
*/
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.
@@ -2,6 +2,8 @@
namespace PHPCI\Plugin\Util;
use PHPCI\Plugin;
/**
* Class ComposerPluginInformation
* @package PHPCI\Plugin\Util
@@ -63,7 +65,7 @@ public function getInstalledPlugins()
public function getPluginClasses()
{
return array_map(
function ($plugin) {
function (Plugin $plugin) {
return $plugin->class;
},
$this->getInstalledPlugins()
@@ -2,6 +2,8 @@
namespace PHPCI\Plugin\Util;
use PHPCI\Plugin;
/**
* Class FilesPluginInformation
* @package PHPCI\Plugin\Util
@@ -66,7 +68,7 @@ public function getInstalledPlugins()
public function getPluginClasses()
{
return array_map(
function ($plugin) {
function (Plugin $plugin) {
return $plugin->class;
},
$this->getInstalledPlugins()
@@ -114,8 +116,6 @@ protected function addPluginFromFile(\SplFileInfo $fileInfo)
*/
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();
@@ -10,7 +10,6 @@
namespace PHPCI\Store;
use b8\Database;
use PHPCI\BuildFactory;
use PHPCI\Model\Build;
use PHPCI\Store\Base\BuildStoreBase;
@@ -1,2 +1,2 @@
*
!.gitignore
!.gitignore
@@ -1,2 +1,2 @@
*
!.gitignore
!.gitignore
@@ -13,4 +13,4 @@ return array(
new \Monolog\Handler\RotatingFileHandler(__DIR__ . DIRECTORY_SEPARATOR . 'everything',3, \Monolog\Logger::DEBUG),
);
},
);
);
@@ -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
);
};
};

0 comments on commit c20ca7c

Please sign in to comment.
You can’t perform that action at this time.