Code style fixes.
This commit is contained in:
parent
a16c82babc
commit
50b117455e
|
@ -55,7 +55,7 @@ class RebuildQueueCommand extends Command
|
|||
);
|
||||
}
|
||||
|
||||
$store = Factory::getStore('Build');
|
||||
$store = Factory::getStore('Build');
|
||||
$result = $store->getByStatus(0);
|
||||
|
||||
$this->logger->addInfo(sprintf('Found %d builds', count($result['items'])));
|
||||
|
|
|
@ -119,10 +119,10 @@ class BuildController extends Controller
|
|||
break;
|
||||
}
|
||||
|
||||
$rebuild = Lang::get('rebuild_now');
|
||||
$rebuild = Lang::get('rebuild_now');
|
||||
$rebuildLink = APP_URL . 'build/rebuild/' . $build->getId();
|
||||
|
||||
$delete = Lang::get('delete_build');
|
||||
$delete = Lang::get('delete_build');
|
||||
$deleteLink = APP_URL . 'build/delete/' . $build->getId();
|
||||
|
||||
$project = Factory::getStore('Project')->getByPrimaryKey($build->getProjectId());
|
||||
|
|
|
@ -82,7 +82,7 @@ class BuildStatusController extends Controller
|
|||
{
|
||||
/* @var Project $project */
|
||||
$project = $this->projectStore->getById($projectId);
|
||||
$xml = new \SimpleXMLElement('<Projects/>');
|
||||
$xml = new \SimpleXMLElement('<Projects/>');
|
||||
|
||||
if (!$project instanceof Project || !$project->getAllowPublicStatus()) {
|
||||
return $this->renderXml($xml);
|
||||
|
|
|
@ -19,10 +19,11 @@ class HomeController extends Controller
|
|||
$this->layout->title = Lang::get('dashboard');
|
||||
|
||||
$widgets = [
|
||||
'left' => [],
|
||||
'left' => [],
|
||||
'right' => [],
|
||||
];
|
||||
$widgets_config = Config::getInstance()->get('php-censor.dashboard_widgets', [
|
||||
|
||||
$widgetsConfig = Config::getInstance()->get('php-censor.dashboard_widgets', [
|
||||
'all_projects' => [
|
||||
'side' => 'left',
|
||||
],
|
||||
|
@ -30,7 +31,8 @@ class HomeController extends Controller
|
|||
'side' => 'right',
|
||||
],
|
||||
]);
|
||||
foreach($widgets_config as $name => $params) {
|
||||
|
||||
foreach($widgetsConfig as $name => $params) {
|
||||
$side = (isset($params['side']) && 'right' === $params['side'])
|
||||
? 'right'
|
||||
: 'left';
|
||||
|
|
|
@ -189,17 +189,15 @@ class SessionController extends Controller
|
|||
{
|
||||
if ($this->request->getMethod() == 'POST') {
|
||||
$email = $this->getParam('email', null);
|
||||
$user = $this->userStore->getByEmail($email);
|
||||
$user = $this->userStore->getByEmail($email);
|
||||
|
||||
if (empty($user)) {
|
||||
$this->view->error = Lang::get('reset_no_user_exists');
|
||||
return $this->view->render();
|
||||
}
|
||||
|
||||
$key = md5(date('Y-m-d') . $user->getHash());
|
||||
$url = APP_URL;
|
||||
|
||||
$message = Lang::get('reset_email_body', $user->getName(), $url, $user->getId(), $key);
|
||||
$key = md5(date('Y-m-d') . $user->getHash());
|
||||
$message = Lang::get('reset_email_body', $user->getName(), APP_URL, $user->getId(), $key);
|
||||
|
||||
$email = new Email();
|
||||
$email->setEmailTo($user->getEmail(), $user->getName());
|
||||
|
|
|
@ -197,7 +197,7 @@ class UserController extends Controller
|
|||
$this->requireAdmin();
|
||||
|
||||
$method = $this->request->getMethod();
|
||||
$user = $this->userStore->getById($userId);
|
||||
$user = $this->userStore->getById($userId);
|
||||
|
||||
if (empty($user)) {
|
||||
throw new NotFoundException(Lang::get('user_n_not_found', $userId));
|
||||
|
@ -291,7 +291,7 @@ class UserController extends Controller
|
|||
{
|
||||
$this->requireAdmin();
|
||||
|
||||
$user = $this->userStore->getById($userId);
|
||||
$user = $this->userStore->getById($userId);
|
||||
|
||||
if (empty($user)) {
|
||||
throw new NotFoundException(Lang::get('user_n_not_found', $userId));
|
||||
|
|
|
@ -423,10 +423,10 @@ class WebhookController extends Controller
|
|||
$url = $payload['pull_request']['commits_url'];
|
||||
|
||||
//for large pull requests, allow grabbing more then the default number of commits
|
||||
$custom_per_page = Config::getInstance()->get('php-censor.github.per_page');
|
||||
$params = [];
|
||||
if ($custom_per_page) {
|
||||
$params['per_page'] = $custom_per_page;
|
||||
$customPerPage = Config::getInstance()->get('php-censor.github.per_page');
|
||||
$params = [];
|
||||
if ($customPerPage) {
|
||||
$params['per_page'] = $customPerPage;
|
||||
}
|
||||
|
||||
$client = new Client();
|
||||
|
@ -490,12 +490,12 @@ class WebhookController extends Controller
|
|||
$project = $this->fetchProject($projectId, ['gitlab', 'git']);
|
||||
|
||||
$payloadString = file_get_contents("php://input");
|
||||
$payload = json_decode($payloadString, true);
|
||||
$payload = json_decode($payloadString, true);
|
||||
|
||||
// build on merge request events
|
||||
if (isset($payload['object_kind']) && $payload['object_kind'] == 'merge_request') {
|
||||
$attributes = $payload['object_attributes'];
|
||||
if ($attributes['state'] == 'opened' || $attributes['state'] == 'reopened') {
|
||||
if ($attributes['state'] === 'opened' || $attributes['state'] === 'reopened') {
|
||||
$branch = $attributes['source_branch'];
|
||||
$commit = $attributes['last_commit'];
|
||||
$committer = $commit['author']['email'];
|
||||
|
@ -520,8 +520,8 @@ class WebhookController extends Controller
|
|||
$status = 'failed';
|
||||
foreach ($payload['commits'] as $commit) {
|
||||
try {
|
||||
$branch = str_replace('refs/heads/', '', $payload['ref']);
|
||||
$committer = $commit['author']['email'];
|
||||
$branch = str_replace('refs/heads/', '', $payload['ref']);
|
||||
$committer = $commit['author']['email'];
|
||||
$results[$commit['id']] = $this->createBuild(
|
||||
Build::SOURCE_WEBHOOK,
|
||||
$project,
|
||||
|
@ -554,11 +554,11 @@ class WebhookController extends Controller
|
|||
*/
|
||||
public function svn($projectId)
|
||||
{
|
||||
$project = $this->fetchProject($projectId, 'svn');
|
||||
$branch = $this->getParam('branch', $project->getBranch());
|
||||
$commit = $this->getParam('commit');
|
||||
$project = $this->fetchProject($projectId, 'svn');
|
||||
$branch = $this->getParam('branch', $project->getBranch());
|
||||
$commit = $this->getParam('commit');
|
||||
$commitMessage = $this->getParam('message');
|
||||
$committer = $this->getParam('committer');
|
||||
$committer = $this->getParam('committer');
|
||||
|
||||
return $this->createBuild(
|
||||
Build::SOURCE_WEBHOOK,
|
||||
|
@ -770,13 +770,13 @@ class WebhookController extends Controller
|
|||
// Check if a build already exists for this commit ID:
|
||||
$builds = $this->buildStore->getByProjectAndCommit($project->getId(), $commitId);
|
||||
|
||||
$ignore_environments = [];
|
||||
$ignore_tags = [];
|
||||
$ignoreEnvironments = [];
|
||||
$ignoreTags = [];
|
||||
if ($builds['count']) {
|
||||
foreach($builds['items'] as $build) {
|
||||
/** @var Build $build */
|
||||
$ignore_environments[$build->getId()] = $build->getEnvironment();
|
||||
$ignore_tags[$build->getId()] = $build->getTag();
|
||||
$ignoreEnvironments[$build->getId()] = $build->getEnvironment();
|
||||
$ignoreTags[$build->getId()] = $build->getTag();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -790,20 +790,20 @@ class WebhookController extends Controller
|
|||
|
||||
$environments = $project->getEnvironmentsObjects();
|
||||
if ($environments['count']) {
|
||||
$created_builds = [];
|
||||
$environment_names = $project->getEnvironmentsNamesByBranch($branch);
|
||||
$createdBuilds = [];
|
||||
$environmentNames = $project->getEnvironmentsNamesByBranch($branch);
|
||||
// use base branch from project
|
||||
if (!empty($environment_names)) {
|
||||
if (!empty($environmentNames)) {
|
||||
$duplicates = [];
|
||||
foreach ($environment_names as $environment_name) {
|
||||
foreach ($environmentNames as $environmentName) {
|
||||
if (
|
||||
!in_array($environment_name, $ignore_environments) ||
|
||||
($tag && !in_array($tag, $ignore_tags, true))
|
||||
!in_array($environmentName, $ignoreEnvironments) ||
|
||||
($tag && !in_array($tag, $ignoreTags, true))
|
||||
) {
|
||||
// If not, create a new build job for it:
|
||||
$build = $this->buildService->createBuild(
|
||||
$project,
|
||||
$environment_name,
|
||||
$environmentName,
|
||||
$commitId,
|
||||
$project->getBranch(),
|
||||
$tag,
|
||||
|
@ -814,19 +814,19 @@ class WebhookController extends Controller
|
|||
$extra
|
||||
);
|
||||
|
||||
$created_builds[] = [
|
||||
$createdBuilds[] = [
|
||||
'id' => $build->getID(),
|
||||
'environment' => $environment_name,
|
||||
'environment' => $environmentName,
|
||||
];
|
||||
} else {
|
||||
$duplicates[] = array_search($environment_name, $ignore_environments);
|
||||
$duplicates[] = array_search($environmentName, $ignoreEnvironments);
|
||||
}
|
||||
}
|
||||
if (!empty($created_builds)) {
|
||||
if (!empty($createdBuilds)) {
|
||||
if (empty($duplicates)) {
|
||||
return ['status' => 'ok', 'builds' => $created_builds];
|
||||
return ['status' => 'ok', 'builds' => $createdBuilds];
|
||||
} else {
|
||||
return ['status' => 'ok', 'builds' => $created_builds, 'message' => sprintf('For this commit some builds already exists (%s)', implode(', ', $duplicates))];
|
||||
return ['status' => 'ok', 'builds' => $createdBuilds, 'message' => sprintf('For this commit some builds already exists (%s)', implode(', ', $duplicates))];
|
||||
}
|
||||
} else {
|
||||
return ['status' => 'ignored', 'message' => sprintf('For this commit already created builds (%s)', implode(', ', $duplicates))];
|
||||
|
@ -835,10 +835,10 @@ class WebhookController extends Controller
|
|||
return ['status' => 'ignored', 'message' => 'Branch not assigned to any environment'];
|
||||
}
|
||||
} else {
|
||||
$environment_name = null;
|
||||
$environmentName = null;
|
||||
if (
|
||||
!in_array($environment_name, $ignore_environments, true) ||
|
||||
($tag && !in_array($tag, $ignore_tags, true))
|
||||
!in_array($environmentName, $ignoreEnvironments, true) ||
|
||||
($tag && !in_array($tag, $ignoreTags, true))
|
||||
) {
|
||||
$build = $this->buildService->createBuild(
|
||||
$project,
|
||||
|
@ -857,7 +857,7 @@ class WebhookController extends Controller
|
|||
} else {
|
||||
return [
|
||||
'status' => 'ignored',
|
||||
'message' => sprintf('Duplicate of build #%d', array_search($environment_name, $ignore_environments)),
|
||||
'message' => sprintf('Duplicate of build #%d', array_search($environmentName, $ignoreEnvironments)),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,15 +72,15 @@ class WidgetBuildErrorsController extends Controller
|
|||
$view->builds = $builds['projects'];
|
||||
$projects = $this->projectStore->getByIds(array_keys($builds['projects']));
|
||||
|
||||
$view_projects = [];
|
||||
$viewProjects = [];
|
||||
foreach($projects as $id => $project) {
|
||||
if (!$project->getArchived()) {
|
||||
$view_projects[$id] = $project;
|
||||
$viewProjects[$id] = $project;
|
||||
} else {
|
||||
unset($builds['projects'][$id]);
|
||||
}
|
||||
}
|
||||
$view->projects = $view_projects;
|
||||
$view->projects = $viewProjects;
|
||||
} else {
|
||||
$view = new View('WidgetBuildErrors/empty');
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class Bitbucket
|
|||
*/
|
||||
public function getPullRequestDiff($repo, $pullRequestId)
|
||||
{
|
||||
$username = Config::getInstance()->get('php-censor.bitbucket.username');
|
||||
$username = Config::getInstance()->get('php-censor.bitbucket.username');
|
||||
$appPassword = Config::getInstance()->get('php-censor.bitbucket.app_password');
|
||||
|
||||
if (empty($username) || empty($appPassword)) {
|
||||
|
|
|
@ -6,7 +6,7 @@ use PHPCensor\Model\Build as BaseBuild;
|
|||
|
||||
/**
|
||||
* The BuildInterpolator class replaces variables in a string with build-specific information.
|
||||
*
|
||||
*
|
||||
* @package PHPCensor\Helper
|
||||
*/
|
||||
class BuildInterpolator
|
||||
|
@ -17,7 +17,7 @@ class BuildInterpolator
|
|||
* @var mixed[]
|
||||
* @see setupInterpolationVars()
|
||||
*/
|
||||
protected $interpolation_vars = [];
|
||||
protected $interpolationVars = [];
|
||||
|
||||
/**
|
||||
* Sets the variables that will be used for interpolation.
|
||||
|
@ -28,46 +28,46 @@ class BuildInterpolator
|
|||
*/
|
||||
public function setupInterpolationVars(BaseBuild $build, $buildPath, $url)
|
||||
{
|
||||
$this->interpolation_vars = [];
|
||||
$this->interpolation_vars['%PHPCI%'] = 1;
|
||||
$this->interpolation_vars['%COMMIT%'] = $build->getCommitId();
|
||||
$this->interpolation_vars['%SHORT_COMMIT%'] = substr($build->getCommitId(), 0, 7);
|
||||
$this->interpolation_vars['%COMMIT_EMAIL%'] = $build->getCommitterEmail();
|
||||
$this->interpolation_vars['%COMMIT_MESSAGE%'] = $build->getCommitMessage();
|
||||
$this->interpolation_vars['%COMMIT_URI%'] = $build->getCommitLink();
|
||||
$this->interpolation_vars['%BRANCH%'] = $build->getBranch();
|
||||
$this->interpolation_vars['%BRANCH_URI%'] = $build->getBranchLink();
|
||||
$this->interpolation_vars['%ENVIRONMENT%'] = $build->getEnvironment();
|
||||
$this->interpolation_vars['%PROJECT%'] = $build->getProjectId();
|
||||
$this->interpolation_vars['%BUILD%'] = $build->getId();
|
||||
$this->interpolation_vars['%PROJECT_TITLE%'] = $build->getProjectTitle();
|
||||
$this->interpolation_vars['%PROJECT_URI%'] = $url . "project/view/" . $build->getProjectId();
|
||||
$this->interpolation_vars['%BUILD_PATH%'] = $buildPath;
|
||||
$this->interpolation_vars['%BUILD_URI%'] = $url . "build/view/" . $build->getId();
|
||||
$this->interpolation_vars['%PHPCI_COMMIT%'] = $this->interpolation_vars['%COMMIT%'];
|
||||
$this->interpolation_vars['%PHPCI_SHORT_COMMIT%'] = $this->interpolation_vars['%SHORT_COMMIT%'];
|
||||
$this->interpolation_vars['%PHPCI_COMMIT_MESSAGE%'] = $this->interpolation_vars['%COMMIT_MESSAGE%'];
|
||||
$this->interpolation_vars['%PHPCI_COMMIT_EMAIL%'] = $this->interpolation_vars['%COMMIT_EMAIL%'];
|
||||
$this->interpolation_vars['%PHPCI_COMMIT_URI%'] = $this->interpolation_vars['%COMMIT_URI%'];
|
||||
$this->interpolation_vars['%PHPCI_PROJECT%'] = $this->interpolation_vars['%PROJECT%'];
|
||||
$this->interpolation_vars['%PHPCI_BUILD%'] = $this->interpolation_vars['%BUILD%'];
|
||||
$this->interpolation_vars['%PHPCI_PROJECT_TITLE%'] = $this->interpolation_vars['%PROJECT_TITLE%'];
|
||||
$this->interpolation_vars['%PHPCI_PROJECT_URI%'] = $this->interpolation_vars['%PROJECT_URI%'];
|
||||
$this->interpolation_vars['%PHPCI_BUILD_PATH%'] = $this->interpolation_vars['%BUILD_PATH%'];
|
||||
$this->interpolation_vars['%PHPCI_BUILD_URI%'] = $this->interpolation_vars['%BUILD_URI%'];
|
||||
$this->interpolationVars = [];
|
||||
$this->interpolationVars['%PHPCI%'] = 1;
|
||||
$this->interpolationVars['%COMMIT%'] = $build->getCommitId();
|
||||
$this->interpolationVars['%SHORT_COMMIT%'] = substr($build->getCommitId(), 0, 7);
|
||||
$this->interpolationVars['%COMMIT_EMAIL%'] = $build->getCommitterEmail();
|
||||
$this->interpolationVars['%COMMIT_MESSAGE%'] = $build->getCommitMessage();
|
||||
$this->interpolationVars['%COMMIT_URI%'] = $build->getCommitLink();
|
||||
$this->interpolationVars['%BRANCH%'] = $build->getBranch();
|
||||
$this->interpolationVars['%BRANCH_URI%'] = $build->getBranchLink();
|
||||
$this->interpolationVars['%ENVIRONMENT%'] = $build->getEnvironment();
|
||||
$this->interpolationVars['%PROJECT%'] = $build->getProjectId();
|
||||
$this->interpolationVars['%BUILD%'] = $build->getId();
|
||||
$this->interpolationVars['%PROJECT_TITLE%'] = $build->getProjectTitle();
|
||||
$this->interpolationVars['%PROJECT_URI%'] = $url . "project/view/" . $build->getProjectId();
|
||||
$this->interpolationVars['%BUILD_PATH%'] = $buildPath;
|
||||
$this->interpolationVars['%BUILD_URI%'] = $url . "build/view/" . $build->getId();
|
||||
$this->interpolationVars['%PHPCI_COMMIT%'] = $this->interpolationVars['%COMMIT%'];
|
||||
$this->interpolationVars['%PHPCI_SHORT_COMMIT%'] = $this->interpolationVars['%SHORT_COMMIT%'];
|
||||
$this->interpolationVars['%PHPCI_COMMIT_MESSAGE%'] = $this->interpolationVars['%COMMIT_MESSAGE%'];
|
||||
$this->interpolationVars['%PHPCI_COMMIT_EMAIL%'] = $this->interpolationVars['%COMMIT_EMAIL%'];
|
||||
$this->interpolationVars['%PHPCI_COMMIT_URI%'] = $this->interpolationVars['%COMMIT_URI%'];
|
||||
$this->interpolationVars['%PHPCI_PROJECT%'] = $this->interpolationVars['%PROJECT%'];
|
||||
$this->interpolationVars['%PHPCI_BUILD%'] = $this->interpolationVars['%BUILD%'];
|
||||
$this->interpolationVars['%PHPCI_PROJECT_TITLE%'] = $this->interpolationVars['%PROJECT_TITLE%'];
|
||||
$this->interpolationVars['%PHPCI_PROJECT_URI%'] = $this->interpolationVars['%PROJECT_URI%'];
|
||||
$this->interpolationVars['%PHPCI_BUILD_PATH%'] = $this->interpolationVars['%BUILD_PATH%'];
|
||||
$this->interpolationVars['%PHPCI_BUILD_URI%'] = $this->interpolationVars['%BUILD_URI%'];
|
||||
|
||||
putenv('PHPCI=1');
|
||||
putenv('PHPCI_COMMIT=' . $this->interpolation_vars['%COMMIT%']);
|
||||
putenv('PHPCI_SHORT_COMMIT=' . $this->interpolation_vars['%SHORT_COMMIT%']);
|
||||
putenv('PHPCI_COMMIT_MESSAGE=' . $this->interpolation_vars['%COMMIT_MESSAGE%']);
|
||||
putenv('PHPCI_COMMIT_EMAIL=' . $this->interpolation_vars['%COMMIT_EMAIL%']);
|
||||
putenv('PHPCI_COMMIT_URI=' . $this->interpolation_vars['%COMMIT_URI%']);
|
||||
putenv('PHPCI_PROJECT=' . $this->interpolation_vars['%PROJECT%']);
|
||||
putenv('PHPCI_BUILD=' . $this->interpolation_vars['%BUILD%']);
|
||||
putenv('PHPCI_PROJECT_TITLE=' . $this->interpolation_vars['%PROJECT_TITLE%']);
|
||||
putenv('PHPCI_BUILD_PATH=' . $this->interpolation_vars['%BUILD_PATH%']);
|
||||
putenv('PHPCI_BUILD_URI=' . $this->interpolation_vars['%BUILD_URI%']);
|
||||
putenv('PHPCI_ENVIRONMENT=' . $this->interpolation_vars['%ENVIRONMENT%']);
|
||||
putenv('PHPCI_COMMIT=' . $this->interpolationVars['%COMMIT%']);
|
||||
putenv('PHPCI_SHORT_COMMIT=' . $this->interpolationVars['%SHORT_COMMIT%']);
|
||||
putenv('PHPCI_COMMIT_MESSAGE=' . $this->interpolationVars['%COMMIT_MESSAGE%']);
|
||||
putenv('PHPCI_COMMIT_EMAIL=' . $this->interpolationVars['%COMMIT_EMAIL%']);
|
||||
putenv('PHPCI_COMMIT_URI=' . $this->interpolationVars['%COMMIT_URI%']);
|
||||
putenv('PHPCI_PROJECT=' . $this->interpolationVars['%PROJECT%']);
|
||||
putenv('PHPCI_BUILD=' . $this->interpolationVars['%BUILD%']);
|
||||
putenv('PHPCI_PROJECT_TITLE=' . $this->interpolationVars['%PROJECT_TITLE%']);
|
||||
putenv('PHPCI_BUILD_PATH=' . $this->interpolationVars['%BUILD_PATH%']);
|
||||
putenv('PHPCI_BUILD_URI=' . $this->interpolationVars['%BUILD_URI%']);
|
||||
putenv('PHPCI_ENVIRONMENT=' . $this->interpolationVars['%ENVIRONMENT%']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,8 +78,8 @@ class BuildInterpolator
|
|||
*/
|
||||
public function interpolate($input)
|
||||
{
|
||||
$keys = array_keys($this->interpolation_vars);
|
||||
$values = array_values($this->interpolation_vars);
|
||||
$keys = array_keys($this->interpolationVars);
|
||||
$values = array_values($this->interpolationVars);
|
||||
return str_replace($keys, $values, $input);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ class CommandExecutor implements CommandExecutorInterface
|
|||
* @param bool $quiet
|
||||
* @param bool $verbose
|
||||
*/
|
||||
public function __construct(BuildLogger $logger, $rootDir, &$quiet = false, &$verbose = false)
|
||||
public function __construct(BuildLogger $logger, $rootDir, $quiet = false, $verbose = false)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
$this->quiet = $quiet;
|
||||
|
|
|
@ -34,9 +34,9 @@ class Github
|
|||
$results[] = $item;
|
||||
}
|
||||
|
||||
foreach ($headers as $header_name => $header) {
|
||||
foreach ($headers as $headerName => $header) {
|
||||
if (
|
||||
'Link' === $header_name &&
|
||||
'Link' === $headerName &&
|
||||
preg_match('/^<([^>]+)>; rel="next"/', implode(', ', $header), $r)
|
||||
) {
|
||||
$host = parse_url($r[1]);
|
||||
|
|
|
@ -31,7 +31,7 @@ class Lang
|
|||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $default_strings = [];
|
||||
protected static $defaultStrings = [];
|
||||
|
||||
/**
|
||||
* Get a specific string from the language file.
|
||||
|
@ -46,8 +46,8 @@ class Lang
|
|||
if (array_key_exists($string, self::$strings)) {
|
||||
$params[0] = self::$strings[$string];
|
||||
return call_user_func_array('sprintf', $params);
|
||||
} elseif (self::DEFAULT_LANGUAGE !== self::$language && array_key_exists($string, self::$default_strings)) {
|
||||
$params[0] = self::$default_strings[$string];
|
||||
} elseif (self::DEFAULT_LANGUAGE !== self::$language && array_key_exists($string, self::$defaultStrings)) {
|
||||
$params[0] = self::$defaultStrings[$string];
|
||||
return call_user_func_array('sprintf', $params);
|
||||
}
|
||||
|
||||
|
@ -124,14 +124,14 @@ class Lang
|
|||
* Initialise the Language helper, try load the language file for the user's browser or the configured default.
|
||||
*
|
||||
* @param Config $config
|
||||
* @param string $language_force
|
||||
* @param string $languageForce
|
||||
*/
|
||||
public static function init(Config $config, $language_force = null)
|
||||
public static function init(Config $config, $languageForce = null)
|
||||
{
|
||||
self::$default_strings = self::loadLanguage(self::DEFAULT_LANGUAGE);
|
||||
self::$defaultStrings = self::loadLanguage(self::DEFAULT_LANGUAGE);
|
||||
self::loadAvailableLanguages();
|
||||
|
||||
if ($language_force && self::setLanguage($language_force)) {
|
||||
if ($languageForce && self::setLanguage($languageForce)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,10 @@ class Lang
|
|||
*/
|
||||
protected static function loadLanguage($language = null)
|
||||
{
|
||||
$language = $language ? $language : self::$language;
|
||||
$language = $language
|
||||
? $language
|
||||
: self::$language;
|
||||
|
||||
$langFile = SRC_DIR . 'Languages' . DIRECTORY_SEPARATOR . 'lang.' . $language . '.php';
|
||||
|
||||
if (!file_exists($langFile)) {
|
||||
|
|
|
@ -62,9 +62,9 @@ class Router
|
|||
//-------
|
||||
// Set up default values for everything:
|
||||
//-------
|
||||
$thisNamespace = 'Controller';
|
||||
$thisNamespace = 'Controller';
|
||||
$thisController = null;
|
||||
$thisAction = null;
|
||||
$thisAction = null;
|
||||
|
||||
if (array_key_exists('namespace', $route['defaults'])) {
|
||||
$thisNamespace = $route['defaults']['namespace'];
|
||||
|
|
|
@ -22,12 +22,12 @@ class BuildDBLogHandler extends AbstractProcessingHandler
|
|||
/**
|
||||
* @var int last flush timestamp
|
||||
*/
|
||||
protected $flush_timestamp = 0;
|
||||
protected $flushTimestamp = 0;
|
||||
|
||||
/**
|
||||
* @var int flush delay, seconds
|
||||
*/
|
||||
protected $flush_delay = 1;
|
||||
protected $flushDelay = 1;
|
||||
|
||||
/**
|
||||
* @param Build $build
|
||||
|
@ -60,7 +60,7 @@ class BuildDBLogHandler extends AbstractProcessingHandler
|
|||
{
|
||||
$this->build->setLog($this->logValue);
|
||||
Factory::getStore('Build')->save($this->build);
|
||||
$this->flush_timestamp = time();
|
||||
$this->flushTimestamp = time();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,7 +74,7 @@ class BuildDBLogHandler extends AbstractProcessingHandler
|
|||
|
||||
$this->logValue .= $message . PHP_EOL;
|
||||
|
||||
if ($this->flush_timestamp < (time() - $this->flush_delay)) {
|
||||
if ($this->flushTimestamp < (time() - $this->flushDelay)) {
|
||||
$this->flushData();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,10 +62,10 @@ class Handler
|
|||
public function handleError($level, $message, $file, $line)
|
||||
{
|
||||
if (error_reporting() & $level) {
|
||||
$exception_level = isset($this->levels[$level]) ? $this->levels[$level] : $level;
|
||||
$exceptionLevel = isset($this->levels[$level]) ? $this->levels[$level] : $level;
|
||||
|
||||
throw new \ErrorException(
|
||||
sprintf('%s: %s in %s line %d', $exception_level, $message, $file, $line),
|
||||
sprintf('%s: %s in %s line %d', $exceptionLevel, $message, $file, $line),
|
||||
0,
|
||||
$level,
|
||||
$file,
|
||||
|
@ -79,22 +79,22 @@ class Handler
|
|||
*/
|
||||
public function handleFatalError()
|
||||
{
|
||||
$fatal_error = error_get_last();
|
||||
$fatalError = error_get_last();
|
||||
|
||||
try {
|
||||
if (($error = error_get_last()) !== null) {
|
||||
$error = new \ErrorException(
|
||||
sprintf(
|
||||
'%s: %s in %s line %d',
|
||||
$fatal_error['type'],
|
||||
$fatal_error['message'],
|
||||
$fatal_error['file'],
|
||||
$fatal_error['line']
|
||||
$fatalError['type'],
|
||||
$fatalError['message'],
|
||||
$fatalError['file'],
|
||||
$fatalError['line']
|
||||
),
|
||||
0,
|
||||
$fatal_error['type'],
|
||||
$fatal_error['file'],
|
||||
$fatal_error['line']
|
||||
$fatalError['type'],
|
||||
$fatalError['file'],
|
||||
$fatalError['line']
|
||||
);
|
||||
$this->log($error);
|
||||
}
|
||||
|
@ -102,15 +102,15 @@ class Handler
|
|||
$error = new \ErrorException(
|
||||
sprintf(
|
||||
'%s: %s in %s line %d',
|
||||
$fatal_error['type'],
|
||||
$fatal_error['message'],
|
||||
$fatal_error['file'],
|
||||
$fatal_error['line']
|
||||
$fatalError['type'],
|
||||
$fatalError['message'],
|
||||
$fatalError['file'],
|
||||
$fatalError['line']
|
||||
),
|
||||
0,
|
||||
$fatal_error['type'],
|
||||
$fatal_error['file'],
|
||||
$fatal_error['line']
|
||||
$fatalError['type'],
|
||||
$fatalError['file'],
|
||||
$fatalError['line']
|
||||
);
|
||||
$this->log($error);
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ class GithubBuild extends GitBuild
|
|||
$project = $this->getProject();
|
||||
|
||||
if (!is_null($project)) {
|
||||
$reference = $project->getReference();
|
||||
$reference = $project->getReference();
|
||||
$commitLink = '<a href="https://github.com/' . $reference . '/issues/$1">#$1</a>';
|
||||
$rtn = preg_replace('/\#([0-9]+)/', $commitLink, $rtn);
|
||||
$rtn = preg_replace('/\@([a-zA-Z0-9_]+)/', '<a href="https://github.com/$1">@$1</a>', $rtn);
|
||||
|
|
|
@ -49,9 +49,9 @@ class GitlabBuild extends GitBuild
|
|||
$key = trim($this->getProject()->getSshPrivateKey());
|
||||
|
||||
if (!empty($key)) {
|
||||
$user = $this->getProject()->getAccessInformation("user");
|
||||
$user = $this->getProject()->getAccessInformation("user");
|
||||
$domain = $this->getProject()->getAccessInformation("domain");
|
||||
$port = $this->getProject()->getAccessInformation('port');
|
||||
$port = $this->getProject()->getAccessInformation('port');
|
||||
|
||||
$url = $user . '@' . $domain . ':';
|
||||
|
||||
|
|
Loading…
Reference in a new issue