Code style fixes.
This commit is contained in:
parent
fa569f3e22
commit
4e68eb7180
89 changed files with 942 additions and 251 deletions
|
|
@ -108,8 +108,10 @@ class Application extends b8\Application
|
|||
|
||||
/**
|
||||
* Loads a particular controller, and injects our layout view into it.
|
||||
* @param $class
|
||||
* @return mixed
|
||||
*
|
||||
* @param string $class
|
||||
*
|
||||
* @return b8\Controller
|
||||
*/
|
||||
protected function loadController($class)
|
||||
{
|
||||
|
|
@ -123,6 +125,7 @@ class Application extends b8\Application
|
|||
|
||||
/**
|
||||
* Injects variables into the layout before rendering it.
|
||||
*
|
||||
* @param View $layout
|
||||
*/
|
||||
protected function setLayoutVariables(View &$layout)
|
||||
|
|
@ -145,8 +148,8 @@ class Application extends b8\Application
|
|||
|
||||
/**
|
||||
* Check whether we should skip auth (because it is disabled)
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function shouldSkipAuth()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,8 +14,10 @@ class BuildFactory
|
|||
{
|
||||
/**
|
||||
* @param $buildId
|
||||
* @return Build
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return Build
|
||||
*/
|
||||
public static function getBuildById($buildId)
|
||||
{
|
||||
|
|
@ -29,10 +31,12 @@ class BuildFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* Takes a generic build and returns a type-specific build model.
|
||||
* @param Build $build The build from which to get a more specific build type.
|
||||
* @return Build
|
||||
*/
|
||||
* Takes a generic build and returns a type-specific build model.
|
||||
*
|
||||
* @param Build $build The build from which to get a more specific build type.
|
||||
*
|
||||
* @return Build
|
||||
*/
|
||||
public static function getBuild(Build $build)
|
||||
{
|
||||
$project = $build->getProject();
|
||||
|
|
|
|||
|
|
@ -123,7 +123,9 @@ class Builder implements LoggerAwareInterface
|
|||
|
||||
/**
|
||||
* Set the config array, as read from .php-censor.yml
|
||||
* @param array|null $config
|
||||
*
|
||||
* @param array $config
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function setConfigArray($config)
|
||||
|
|
@ -138,7 +140,9 @@ class Builder implements LoggerAwareInterface
|
|||
|
||||
/**
|
||||
* Access a variable from the .php-censor.yml file.
|
||||
* @param string
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getConfig($key)
|
||||
|
|
@ -154,7 +158,9 @@ class Builder implements LoggerAwareInterface
|
|||
|
||||
/**
|
||||
* Access a variable from the config.yml
|
||||
* @param $key
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSystemConfig($key)
|
||||
|
|
@ -163,7 +169,7 @@ class Builder implements LoggerAwareInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @return string The title of the project being built.
|
||||
* @return string The title of the project being built.
|
||||
*/
|
||||
public function getBuildProjectTitle()
|
||||
{
|
||||
|
|
@ -271,6 +277,8 @@ class Builder implements LoggerAwareInterface
|
|||
|
||||
/**
|
||||
* Used by this class, and plugins, to execute shell commands.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function executeCommand()
|
||||
{
|
||||
|
|
@ -279,6 +287,8 @@ class Builder implements LoggerAwareInterface
|
|||
|
||||
/**
|
||||
* Returns the output from the last command run.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLastOutput()
|
||||
{
|
||||
|
|
@ -287,7 +297,8 @@ class Builder implements LoggerAwareInterface
|
|||
|
||||
/**
|
||||
* Specify whether exec output should be logged.
|
||||
* @param bool $enableLog
|
||||
*
|
||||
* @param boolean $enableLog
|
||||
*/
|
||||
public function logExecOutput($enableLog = true)
|
||||
{
|
||||
|
|
@ -313,7 +324,9 @@ class Builder implements LoggerAwareInterface
|
|||
/**
|
||||
* Replace every occurrence of the interpolation vars in the given string
|
||||
* Example: "This is build %PHPCI_BUILD%" => "This is build 182"
|
||||
*
|
||||
* @param string $input
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function interpolate($input)
|
||||
|
|
@ -323,6 +336,10 @@ class Builder implements LoggerAwareInterface
|
|||
|
||||
/**
|
||||
* Set up a working copy of the project for building.
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function setupBuild()
|
||||
{
|
||||
|
|
@ -360,7 +377,6 @@ class Builder implements LoggerAwareInterface
|
|||
* Sets a logger instance on the object
|
||||
*
|
||||
* @param LoggerInterface $logger
|
||||
* @return null
|
||||
*/
|
||||
public function setLogger(LoggerInterface $logger)
|
||||
{
|
||||
|
|
@ -369,9 +385,10 @@ class Builder implements LoggerAwareInterface
|
|||
|
||||
/**
|
||||
* Write to the build log.
|
||||
* @param $message
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $level
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*/
|
||||
public function log($message, $level = LogLevel::INFO, $context = [])
|
||||
{
|
||||
|
|
@ -391,7 +408,7 @@ class Builder implements LoggerAwareInterface
|
|||
/**
|
||||
* Add a failure-coloured message to the log.
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $message
|
||||
* @param \Exception $exception The exception that caused the error.
|
||||
*/
|
||||
public function logFailure($message, \Exception $exception = null)
|
||||
|
|
@ -413,6 +430,7 @@ class Builder implements LoggerAwareInterface
|
|||
* Returns a configured instance of the plugin factory.
|
||||
*
|
||||
* @param Build $build
|
||||
*
|
||||
* @return PluginFactory
|
||||
*/
|
||||
private function buildPluginFactory(Build $build)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
namespace PHPCensor;
|
||||
|
||||
class BuilderException extends \Exception {
|
||||
class BuilderException extends \Exception
|
||||
{
|
||||
/** Fail start build - non fatal */
|
||||
const FAIL_START = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class InstallCommand extends Command
|
|||
|
||||
/**
|
||||
* @param OutputInterface $output
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function verifyNotInstalled(OutputInterface $output)
|
||||
|
|
@ -126,7 +126,7 @@ class InstallCommand extends Command
|
|||
* Check PHP version, required modules and for disabled functions.
|
||||
*
|
||||
* @param OutputInterface $output
|
||||
*
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function checkRequirements(OutputInterface $output)
|
||||
|
|
@ -222,7 +222,7 @@ class InstallCommand extends Command
|
|||
*
|
||||
* @param InputInterface $input
|
||||
* @param OutputInterface $output
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getConfigInformation(InputInterface $input, OutputInterface $output)
|
||||
|
|
@ -306,10 +306,10 @@ class InstallCommand extends Command
|
|||
|
||||
/**
|
||||
* If the user wants to use a queue, get the necessary details.
|
||||
*
|
||||
*
|
||||
* @param InputInterface $input
|
||||
* @param OutputInterface $output
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getQueueInformation(InputInterface $input, OutputInterface $output)
|
||||
|
|
@ -361,7 +361,7 @@ class InstallCommand extends Command
|
|||
*
|
||||
* @param InputInterface $input
|
||||
* @param OutputInterface $output
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getDatabaseInformation(InputInterface $input, OutputInterface $output)
|
||||
|
|
@ -427,10 +427,10 @@ class InstallCommand extends Command
|
|||
|
||||
/**
|
||||
* Try and connect to DB using the details provided
|
||||
*
|
||||
*
|
||||
* @param array $db
|
||||
* @param OutputInterface $output
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function verifyDatabaseDetails(array $db, OutputInterface $output)
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class RebuildCommand extends Command
|
|||
|
||||
/**
|
||||
* Called when log entries are made in Builder / the plugins.
|
||||
*
|
||||
*
|
||||
* @see \PHPCensor\Builder::log()
|
||||
*/
|
||||
public function logCallback($log)
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ class Controller extends \b8\Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Config $config
|
||||
* @param Request $request
|
||||
* @param Config $config
|
||||
* @param Request $request
|
||||
* @param Response $response
|
||||
*/
|
||||
public function __construct(Config $config, Request $request, Response $response)
|
||||
|
|
@ -61,7 +61,8 @@ class Controller extends \b8\Controller
|
|||
|
||||
/**
|
||||
* Set the view that this controller action should use.
|
||||
* @param $action
|
||||
*
|
||||
* @param string $action
|
||||
*/
|
||||
protected function setView($action)
|
||||
{
|
||||
|
|
@ -72,9 +73,10 @@ class Controller extends \b8\Controller
|
|||
|
||||
/**
|
||||
* Handle the incoming request.
|
||||
* @param $action
|
||||
* @param $actionParams
|
||||
*
|
||||
*
|
||||
* @param string $action
|
||||
* @param array $actionParams
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function handleAction($action, $actionParams)
|
||||
|
|
@ -99,6 +101,7 @@ class Controller extends \b8\Controller
|
|||
|
||||
/**
|
||||
* Require that the currently logged in user is an administrator.
|
||||
*
|
||||
* @throws ForbiddenException
|
||||
*/
|
||||
protected function requireAdmin()
|
||||
|
|
@ -110,7 +113,8 @@ class Controller extends \b8\Controller
|
|||
|
||||
/**
|
||||
* Check if the currently logged in user is an administrator.
|
||||
* @return bool
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function currentUserIsAdmin()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ class BuildStatusController extends Controller
|
|||
* Returns the appropriate build status image in SVG format for a given project.
|
||||
*
|
||||
* @param $projectId
|
||||
*
|
||||
*
|
||||
* @return b8\Http\Response|b8\Http\Response\RedirectResponse
|
||||
*/
|
||||
public function image($projectId)
|
||||
|
|
@ -175,11 +175,11 @@ class BuildStatusController extends Controller
|
|||
|
||||
/**
|
||||
* View the public status page of a given project, if enabled.
|
||||
*
|
||||
*
|
||||
* @param integer $projectId
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*
|
||||
* @throws \b8\Exception\HttpException\NotFoundException
|
||||
*/
|
||||
public function view($projectId)
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class ProjectController extends PHPCensor\Controller
|
|||
|
||||
/**
|
||||
* View a specific project.
|
||||
*
|
||||
*
|
||||
* @param integer $projectId
|
||||
*
|
||||
* @throws NotFoundException
|
||||
|
|
@ -163,7 +163,7 @@ class ProjectController extends PHPCensor\Controller
|
|||
|
||||
/**
|
||||
* Create a new pending build for a project.
|
||||
*
|
||||
*
|
||||
* @param integer $projectId
|
||||
*
|
||||
* @throws NotFoundException
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ class WebhookController extends Controller
|
|||
* Called by POSTing to /webhook/git/<project_id>?branch=<branch>&commit=<commit>
|
||||
*
|
||||
* @param string $projectId
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function git($projectId)
|
||||
|
|
@ -377,12 +377,12 @@ class WebhookController extends Controller
|
|||
|
||||
/**
|
||||
* Handle the payload when Github sends a Pull Request webhook.
|
||||
*
|
||||
*
|
||||
* @param Project $project
|
||||
* @param array $payload
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function githubPullRequest(Project $project, array $payload)
|
||||
|
|
@ -512,9 +512,9 @@ class WebhookController extends Controller
|
|||
* Called by POSTing to /webhook/svn/<project_id>?branch=<branch>&commit=<commit>
|
||||
*
|
||||
* @author Sylvain Lévesque <slevesque@gezere.com>
|
||||
*
|
||||
*
|
||||
* @param string $projectId
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function svn($projectId)
|
||||
|
|
@ -530,9 +530,9 @@ class WebhookController extends Controller
|
|||
|
||||
/**
|
||||
* Called by Gogs Webhooks:
|
||||
*
|
||||
*
|
||||
* @param string $projectId
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function gogs($projectId)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class BuildInterpolator
|
|||
|
||||
/**
|
||||
* Sets the variables that will be used for interpolation.
|
||||
*
|
||||
*
|
||||
* @param BaseBuild $build
|
||||
* @param string $buildPath
|
||||
* @param string $url
|
||||
|
|
|
|||
|
|
@ -26,7 +26,14 @@ class CommandExecutor implements CommandExecutorInterface
|
|||
*/
|
||||
protected $verbose;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $lastOutput;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $lastError;
|
||||
|
||||
public $logExecOutput = true;
|
||||
|
|
@ -62,9 +69,9 @@ class CommandExecutor implements CommandExecutorInterface
|
|||
|
||||
/**
|
||||
* Executes shell commands.
|
||||
*
|
||||
*
|
||||
* @param array $args
|
||||
*
|
||||
*
|
||||
* @return bool Indicates success
|
||||
*/
|
||||
public function executeCommand($args = [])
|
||||
|
|
@ -161,6 +168,8 @@ class CommandExecutor implements CommandExecutorInterface
|
|||
|
||||
/**
|
||||
* Returns the output from the last command run.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLastOutput()
|
||||
{
|
||||
|
|
@ -169,6 +178,8 @@ class CommandExecutor implements CommandExecutorInterface
|
|||
|
||||
/**
|
||||
* Returns the stderr output from the last command run.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLastError()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,12 +10,14 @@ interface CommandExecutorInterface
|
|||
*
|
||||
* @param array $args
|
||||
*
|
||||
* @return bool Indicates success
|
||||
* @return boolean Indicates success
|
||||
*/
|
||||
public function executeCommand($args = []);
|
||||
|
||||
/**
|
||||
* Returns the output from the last command run.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLastOutput();
|
||||
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ class LoginIsDisabled
|
|||
{
|
||||
/**
|
||||
* Checks if
|
||||
*
|
||||
*
|
||||
* @param $method
|
||||
* @param array $params
|
||||
*
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function __call($method, $params = [])
|
||||
|
|
|
|||
|
|
@ -4,9 +4,6 @@ use Phinx\Migration\AbstractMigration;
|
|||
|
||||
class AddUserProviders extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* Migrate Up.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// Add the provider columns
|
||||
|
|
@ -25,9 +22,6 @@ class AddUserProviders extends AbstractMigration
|
|||
->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrate Down.
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
// Remove the provider columns
|
||||
|
|
|
|||
|
|
@ -4,5 +4,4 @@ namespace PHPCensor;
|
|||
|
||||
abstract class Model extends \b8\Model
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ class GithubBuild extends RemoteGitBuild
|
|||
|
||||
/**
|
||||
* Get a parsed version of the commit message, with links to issues and commits.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCommitMessage()
|
||||
|
|
@ -138,7 +138,7 @@ class GithubBuild extends RemoteGitBuild
|
|||
|
||||
/**
|
||||
* Get a template to use for generating links to files.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFileLinkTemplate()
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ abstract class Plugin
|
|||
/**
|
||||
* Find a binary required by a plugin.
|
||||
*
|
||||
* @param string $binary
|
||||
* @param bool $quiet Returns null instead of throwing an exception.
|
||||
* @param string $binary
|
||||
* @param boolean $quiet Returns null instead of throwing an exception.
|
||||
*
|
||||
* @return null|string
|
||||
*
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class Atoum extends Plugin
|
|||
|
||||
/**
|
||||
* Run the Atoum plugin.
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function execute()
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Email extends Plugin
|
|||
|
||||
/**
|
||||
* Send a notification mail.
|
||||
*
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function execute()
|
||||
|
|
@ -77,7 +77,7 @@ class Email extends Plugin
|
|||
* @param string[] $ccList
|
||||
* @param string $subject Email subject
|
||||
* @param string $body Email body
|
||||
*
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
protected function sendEmail($toAddress, $ccList, $subject, $body)
|
||||
|
|
|
|||
|
|
@ -127,10 +127,10 @@ class Mysql extends 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
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getImportCommand($import_file, $database = null)
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@ class PhpCpd extends Plugin implements ZeroConfigPluginInterface
|
|||
|
||||
/**
|
||||
* Check if this plugin can be executed.
|
||||
*
|
||||
*
|
||||
* @param $stage
|
||||
* @param Builder $builder
|
||||
* @param Build $build
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function canExecute($stage, Builder $builder, Build $build)
|
||||
|
|
@ -115,11 +115,11 @@ class PhpCpd extends Plugin implements ZeroConfigPluginInterface
|
|||
|
||||
/**
|
||||
* Process the PHPCPD XML report.
|
||||
*
|
||||
*
|
||||
* @param $xmlString
|
||||
*
|
||||
*
|
||||
* @return integer
|
||||
*
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function processReport($xmlString)
|
||||
|
|
|
|||
|
|
@ -127,11 +127,11 @@ class PhpMessDetector extends Plugin implements ZeroConfigPluginInterface
|
|||
|
||||
/**
|
||||
* Process PHPMD's XML output report.
|
||||
*
|
||||
*
|
||||
* @param $xmlString
|
||||
*
|
||||
*
|
||||
* @return integer
|
||||
*
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function processReport($xmlString)
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class Shell extends Plugin
|
|||
|
||||
/**
|
||||
* Runs the shell command.
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function execute()
|
||||
|
|
|
|||
|
|
@ -43,10 +43,10 @@ class Executor
|
|||
|
||||
/**
|
||||
* Execute a the appropriate set of plugins for a given build stage.
|
||||
*
|
||||
*
|
||||
* @param array $config Configuration
|
||||
* @param string $stage
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function executePlugins($config, $stage)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Factory
|
|||
* Check PosixProcessControl, WindowsProcessControl and UnixProcessControl, in that order.
|
||||
*
|
||||
* @return ProcessControlInterface
|
||||
*
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function createProcessControl()
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ namespace PHPCensor\ProcessControl;
|
|||
class PosixProcessControl implements ProcessControlInterface
|
||||
{
|
||||
/**
|
||||
* @param integer $pid
|
||||
*
|
||||
* @param int $pid
|
||||
* @return bool
|
||||
*/
|
||||
public function isRunning($pid)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ interface ProcessControlInterface
|
|||
*
|
||||
* @param int $pid The process identifier.
|
||||
* @param bool $forcefully Whether to gently (false) or forcefully (true) terminate the process.
|
||||
*
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function kill($pid, $forcefully = false);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ class UnixProcessControl implements ProcessControlInterface
|
|||
* Check process using the "ps" command.
|
||||
*
|
||||
* @param int $pid
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isRunning($pid)
|
||||
|
|
|
|||
|
|
@ -11,12 +11,13 @@ use PHPCensor\Model\User;
|
|||
*/
|
||||
interface LoginPasswordProviderInterface extends UserProviderInterface
|
||||
{
|
||||
/** Verify if the supplied password matches the user's one.
|
||||
/**
|
||||
* Verify if the supplied password matches the user's one.
|
||||
*
|
||||
* @param User $user
|
||||
* @param User $user
|
||||
* @param string $password
|
||||
*
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
public function verifyPassword(User $user, $password);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ use b8\Config;
|
|||
class Service
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var Service
|
||||
*/
|
||||
static private $instance;
|
||||
|
||||
/** Return the service singletion.
|
||||
/**
|
||||
* Return the service singleton.
|
||||
*
|
||||
* @return Service
|
||||
*/
|
||||
|
|
@ -43,11 +43,12 @@ class Service
|
|||
return self::$instance;
|
||||
}
|
||||
|
||||
/** Create a provider from a given configuration.
|
||||
/**
|
||||
* Create a provider from a given configuration.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string|array $config
|
||||
*
|
||||
*
|
||||
* @return UserProviderInterface
|
||||
*/
|
||||
public static function buildProvider($key, $config)
|
||||
|
|
@ -60,13 +61,15 @@ class Service
|
|||
return new $class($key, $config);
|
||||
}
|
||||
|
||||
/** The table of providers.
|
||||
/**
|
||||
* The table of providers.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $providers;
|
||||
|
||||
/** Initialize the service.
|
||||
/**
|
||||
* Initialize the service.
|
||||
*
|
||||
* @param array $providers
|
||||
*/
|
||||
|
|
@ -75,7 +78,8 @@ class Service
|
|||
$this->providers = $providers;
|
||||
}
|
||||
|
||||
/** Return all providers.
|
||||
/**
|
||||
* Return all providers.
|
||||
*
|
||||
* @return UserProviderInterface[]
|
||||
*/
|
||||
|
|
@ -84,7 +88,8 @@ class Service
|
|||
return $this->providers;
|
||||
}
|
||||
|
||||
/** Return the user providers that allows password authentication.
|
||||
/**
|
||||
* Return the user providers that allows password authentication.
|
||||
*
|
||||
* @return LoginPasswordProviderInterface[]
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ abstract class AbstractProvider implements UserProviderInterface
|
|||
|
||||
/**
|
||||
* AbstractProvider constructor
|
||||
*
|
||||
*
|
||||
* @param string $key
|
||||
* @param array $config
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -12,6 +12,12 @@ use PHPCensor\Security\Authentication\LoginPasswordProviderInterface;
|
|||
*/
|
||||
class Internal extends AbstractProvider implements LoginPasswordProviderInterface
|
||||
{
|
||||
/**
|
||||
* @param User $user
|
||||
* @param string $password
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function verifyPassword(User $user, $password)
|
||||
{
|
||||
return password_verify($password, $user->getHash());
|
||||
|
|
@ -22,6 +28,11 @@ class Internal extends AbstractProvider implements LoginPasswordProviderInterfac
|
|||
// Always fine
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $identifier
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function provisionUser($identifier)
|
||||
{
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,12 @@ use PHPCensor\Store\UserStore;
|
|||
*/
|
||||
class Ldap extends AbstractProvider implements LoginPasswordProviderInterface
|
||||
{
|
||||
/**
|
||||
* @param User $user
|
||||
* @param string $password
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function verifyPassword(User $user, $password)
|
||||
{
|
||||
if (isset($this->config['data'])) {
|
||||
|
|
@ -59,6 +65,11 @@ class Ldap extends AbstractProvider implements LoginPasswordProviderInterface
|
|||
// Always fine
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $identifier
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function provisionUser($identifier)
|
||||
{
|
||||
/** @var UserStore $user */
|
||||
|
|
|
|||
|
|
@ -12,13 +12,15 @@ use PHPCensor\Model\User;
|
|||
interface UserProviderInterface
|
||||
{
|
||||
|
||||
/** Check if all software requirements are met (libraries, extensions, ...)
|
||||
/**
|
||||
* Check if all software requirements are met (libraries, extensions, ...)
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function checkRequirements();
|
||||
|
||||
/** Provision an new user for the given identifier.
|
||||
/**
|
||||
* Provision an new user for the given identifier.
|
||||
*
|
||||
* @param string $identifier The user identifier.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class BuildService
|
|||
protected $buildStore;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @var boolean
|
||||
*/
|
||||
public $queueError = false;
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ class BuildService
|
|||
* @param integer $source
|
||||
* @param integer $userId
|
||||
* @param string|null $extra
|
||||
*
|
||||
*
|
||||
* @return \PHPCensor\Model\Build
|
||||
*/
|
||||
public function createBuild(
|
||||
|
|
@ -109,6 +109,7 @@ class BuildService
|
|||
|
||||
/**
|
||||
* @param Build $copyFrom
|
||||
*
|
||||
* @return \PHPCensor\Model\Build
|
||||
*/
|
||||
public function createDuplicateBuild(Build $copyFrom)
|
||||
|
|
@ -143,8 +144,10 @@ class BuildService
|
|||
|
||||
/**
|
||||
* Delete a given build.
|
||||
*
|
||||
* @param Build $build
|
||||
* @return bool
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function deleteBuild(Build $build)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,32 +10,44 @@ use PHPCensor\Model\Build;
|
|||
*/
|
||||
class BuildStatusService
|
||||
{
|
||||
/* @var BuildStatusService */
|
||||
/**
|
||||
* @var BuildStatusService
|
||||
*/
|
||||
protected $prevService = null;
|
||||
|
||||
/* @var Project */
|
||||
/**
|
||||
* @var Project
|
||||
*/
|
||||
protected $project;
|
||||
|
||||
/** @var string */
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $branch;
|
||||
|
||||
/* @var Build */
|
||||
/**
|
||||
* @var Build
|
||||
*/
|
||||
protected $build;
|
||||
|
||||
/** @var string */
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $url;
|
||||
|
||||
/** @var array */
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $finishedStatusIds = [
|
||||
Build::STATUS_SUCCESS,
|
||||
Build::STATUS_FAILED,
|
||||
];
|
||||
|
||||
/**
|
||||
* @param $branch
|
||||
* @param string $branch
|
||||
* @param Project $project
|
||||
* @param Build $build
|
||||
* @param bool $isParent
|
||||
* @param Build $build
|
||||
* @param boolean $isParent
|
||||
*/
|
||||
public function __construct(
|
||||
$branch,
|
||||
|
|
@ -55,7 +67,7 @@ class BuildStatusService
|
|||
}
|
||||
|
||||
/**
|
||||
* @param $url
|
||||
* @param string $url
|
||||
*/
|
||||
public function setUrl($url)
|
||||
{
|
||||
|
|
@ -71,7 +83,8 @@ class BuildStatusService
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $isParent
|
||||
* @param boolean $isParent
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function loadParentBuild($isParent = true)
|
||||
|
|
@ -114,7 +127,7 @@ class BuildStatusService
|
|||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
public function isFinished()
|
||||
{
|
||||
|
|
@ -162,6 +175,7 @@ class BuildStatusService
|
|||
|
||||
/**
|
||||
* @param Build $build
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBuildStatus(Build $build)
|
||||
|
|
|
|||
|
|
@ -46,11 +46,13 @@ class ProjectService
|
|||
|
||||
/**
|
||||
* Update the properties of a given project.
|
||||
*
|
||||
* @param Project $project
|
||||
* @param string $title
|
||||
* @param string $type
|
||||
* @param string $reference
|
||||
* @param array $options
|
||||
*
|
||||
* @return \PHPCensor\Model\Project
|
||||
*/
|
||||
public function updateProject(Project $project, $title, $type, $reference, $options = [])
|
||||
|
|
@ -111,7 +113,9 @@ class ProjectService
|
|||
|
||||
/**
|
||||
* Delete a given project.
|
||||
*
|
||||
* @param Project $project
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteProject(Project $project)
|
||||
|
|
@ -121,7 +125,9 @@ class ProjectService
|
|||
|
||||
/**
|
||||
* In circumstances where it is necessary, populate access information based on other project properties.
|
||||
*
|
||||
* @see ProjectService::createProject()
|
||||
*
|
||||
* @param Project $project
|
||||
*/
|
||||
protected function processAccessInformation(Project &$project)
|
||||
|
|
|
|||
|
|
@ -25,14 +25,14 @@ class UserService
|
|||
|
||||
/**
|
||||
* Create a new user.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $email
|
||||
* @param string $providerKey
|
||||
* @param string $providerData
|
||||
* @param string $password
|
||||
* @param bool $isAdmin
|
||||
*
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $email
|
||||
* @param string $providerKey
|
||||
* @param string $providerData
|
||||
* @param string $password
|
||||
* @param boolean $isAdmin
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function createUser($name, $email, $providerKey, $providerData, $password, $isAdmin = false)
|
||||
|
|
@ -50,15 +50,15 @@ class UserService
|
|||
|
||||
/**
|
||||
* Update a user.
|
||||
*
|
||||
*
|
||||
* @param User $user
|
||||
* @param string $name
|
||||
* @param string $emailAddress
|
||||
* @param string $password
|
||||
* @param bool $isAdmin
|
||||
* @param boolean $isAdmin
|
||||
* @param string $language
|
||||
* @param integer $perPage
|
||||
*
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function updateUser(User $user, $name, $emailAddress, $password = null, $isAdmin = null, $language = null, $perPage = null)
|
||||
|
|
@ -82,7 +82,9 @@ class UserService
|
|||
|
||||
/**
|
||||
* Delete a user.
|
||||
*
|
||||
* @param User $user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteUser(User $user)
|
||||
|
|
|
|||
|
|
@ -4,5 +4,4 @@ namespace PHPCensor;
|
|||
|
||||
abstract class Store extends \b8\Store
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,19 @@ use PHPCensor\Store;
|
|||
|
||||
class BuildErrorStore extends Store
|
||||
{
|
||||
protected $tableName = 'build_error';
|
||||
protected $modelName = '\PHPCensor\Model\BuildError';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'build_error';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $modelName = '\PHPCensor\Model\BuildError';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -10,14 +10,19 @@ use b8\Database;
|
|||
*/
|
||||
class BuildErrorWriter
|
||||
{
|
||||
/** @var int */
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
protected $buildId;
|
||||
|
||||
/** @var array */
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $errors = [];
|
||||
|
||||
/**
|
||||
* @var int
|
||||
* @var integer
|
||||
*
|
||||
* @see https://stackoverflow.com/questions/40361164/pdoexception-sqlstatehy000-general-error-7-number-of-parameters-must-be-bet
|
||||
*/
|
||||
protected $bufferSize;
|
||||
|
|
@ -46,10 +51,10 @@ class BuildErrorWriter
|
|||
*
|
||||
* @param string $plugin
|
||||
* @param string $message
|
||||
* @param int $severity
|
||||
* @param integer $severity
|
||||
* @param string $file
|
||||
* @param int $lineStart
|
||||
* @param int $lineEnd
|
||||
* @param integer $lineStart
|
||||
* @param integer $lineEnd
|
||||
* @param \DateTime $createdDate
|
||||
*/
|
||||
public function write(
|
||||
|
|
|
|||
|
|
@ -9,8 +9,19 @@ use b8\Exception\HttpException;
|
|||
|
||||
class BuildMetaStore extends Store
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'build_meta';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $modelName = '\PHPCensor\Model\BuildMeta';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
|
|
@ -96,9 +107,9 @@ class BuildMetaStore extends Store
|
|||
|
||||
/**
|
||||
* Only used by an upgrade migration to move errors from build_meta to build_error
|
||||
*
|
||||
* @param $limit
|
||||
*
|
||||
*
|
||||
* @param integer $limit
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getErrorsForUpgrade($limit)
|
||||
|
|
|
|||
|
|
@ -12,8 +12,19 @@ use PHPCensor\Store;
|
|||
*/
|
||||
class BuildStore extends Store
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'build';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $modelName = '\PHPCensor\Model\Build';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
|
|
@ -226,8 +237,10 @@ class BuildStore extends Store
|
|||
|
||||
/**
|
||||
* Return an array of the latest builds for all projects.
|
||||
* @param int $limit_by_project
|
||||
* @param int $limit_all
|
||||
*
|
||||
* @param integer $limit_by_project
|
||||
* @param integer $limit_all
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAllProjectsLatestBuilds($limit_by_project = 5, $limit_all = 10)
|
||||
|
|
@ -312,10 +325,10 @@ class BuildStore extends Store
|
|||
|
||||
/**
|
||||
* Return an array of builds for a given project and commit ID.
|
||||
*
|
||||
*
|
||||
* @param integer $projectId
|
||||
* @param string $commitId
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getByProjectAndCommit($projectId, $commitId)
|
||||
|
|
|
|||
|
|
@ -9,8 +9,19 @@ use b8\Exception\HttpException;
|
|||
|
||||
class EnvironmentStore extends Store
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'environment';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $modelName = '\PHPCensor\Model\Environment';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -9,8 +9,19 @@ use PHPCensor\Model\ProjectGroup;
|
|||
|
||||
class ProjectGroupStore extends Store
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'project_group';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $modelName = '\PHPCensor\Model\ProjectGroup';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -12,8 +12,19 @@ use b8\Exception\HttpException;
|
|||
*/
|
||||
class ProjectStore extends Store
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'project';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $modelName = '\PHPCensor\Model\Project';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
|
|
@ -60,7 +71,12 @@ class ProjectStore extends Store
|
|||
|
||||
/**
|
||||
* Get a single Project by Ids.
|
||||
* @param int[]
|
||||
*
|
||||
* @param integer[] $values
|
||||
* @param string $useConnection
|
||||
*
|
||||
* @throws HttpException
|
||||
*
|
||||
* @return Project[]
|
||||
*/
|
||||
public function getByIds($values, $useConnection = 'read')
|
||||
|
|
|
|||
|
|
@ -12,8 +12,19 @@ use PHPCensor\Model\User;
|
|||
*/
|
||||
class UserStore extends Store
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'user';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $modelName = '\PHPCensor\Model\User';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -19,24 +19,28 @@ class BuildWorker
|
|||
{
|
||||
/**
|
||||
* If this variable changes to false, the worker will stop after the current build.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $run = true;
|
||||
|
||||
/**
|
||||
* The logger for builds to use.
|
||||
*
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* beanstalkd host
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $host;
|
||||
|
||||
/**
|
||||
* beanstalkd queue to watch
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $queue;
|
||||
|
|
@ -52,8 +56,8 @@ class BuildWorker
|
|||
protected $totalJobs = 0;
|
||||
|
||||
/**
|
||||
* @param $host
|
||||
* @param $queue
|
||||
* @param string $host
|
||||
* @param string $queue
|
||||
*/
|
||||
public function __construct($host, $queue)
|
||||
{
|
||||
|
|
@ -147,9 +151,11 @@ class BuildWorker
|
|||
|
||||
/**
|
||||
* Checks that the job received is actually, and has a valid type.
|
||||
* @param Job $job
|
||||
* @param $jobData
|
||||
* @return bool
|
||||
*
|
||||
* @param Job $job
|
||||
* @param array $jobData
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function verifyJob(Job $job, $jobData)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,5 +9,12 @@ use PHPCensor\Model\Build;
|
|||
*/
|
||||
interface ZeroConfigPluginInterface
|
||||
{
|
||||
/**
|
||||
* @param string $stage
|
||||
* @param Builder $builder
|
||||
* @param Build $build
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function canExecute($stage, Builder $builder, Build $build);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue