Code style fixes (and -> &&).

This commit is contained in:
Dmitry Khomutov 2018-03-04 23:42:14 +07:00
parent 3b700f8d3c
commit a16c82babc
No known key found for this signature in database
GPG key ID: EC19426474B37AAC
3 changed files with 9 additions and 7 deletions

View file

@ -31,7 +31,9 @@ class HomeController extends Controller
],
]);
foreach($widgets_config as $name => $params) {
$side = (isset($params['side']) and ($params['side'] == 'right')) ? 'right' : 'left';
$side = (isset($params['side']) && 'right' === $params['side'])
? 'right'
: 'left';
$widgets[$side][$name] = $params;
}

View file

@ -664,17 +664,17 @@ class WebhookController extends Controller
$activeStates = ['open'];
$inactiveStates = ['closed'];
if (!in_array($action, $activeActions) and !in_array($action, $inactiveActions)) {
if (!in_array($action, $activeActions) && !in_array($action, $inactiveActions)) {
return ['status' => 'ignored', 'message' => 'Action ' . $action . ' ignored'];
}
if (!in_array($state, $activeStates) and !in_array($state, $inactiveStates)) {
if (!in_array($state, $activeStates) && !in_array($state, $inactiveStates)) {
return ['status' => 'ignored', 'message' => 'State ' . $state . ' ignored'];
}
$envs = [];
// Get environment form labels
if (in_array($action, $activeActions) and in_array($state, $activeStates)) {
if (in_array($action, $activeActions) && in_array($state, $activeStates)) {
if (isset($pullRequest['labels']) && is_array($pullRequest['labels'])) {
foreach ($pullRequest['labels'] as $label) {
if (strpos($label['name'], 'env:') === 0) {
@ -708,7 +708,7 @@ class WebhookController extends Controller
}
}
if (($state == 'closed') and $pullRequest['merged']) {
if ('closed' === $state && $pullRequest['merged']) {
// update base branch environments
$environmentNames = $project->getEnvironmentsNamesByBranch($pullRequest['base_branch']);
$envsUpdated = array_merge($envsUpdated, $environmentNames);

View file

@ -298,13 +298,13 @@ class BuildStore extends Store
}
$latest[] = $build;
}
if (empty($projects[$project_id][$environment]['success']) and ($item['status'] == Build::STATUS_SUCCESS)) {
if (empty($projects[$project_id][$environment]['success']) && Build::STATUS_SUCCESS === $item['status']) {
if (is_null($build)) {
$build = new Build($item);
}
$projects[$project_id][$environment]['success'] = $build;
}
if (empty($projects[$project_id][$environment]['failed']) and ($item['status'] == Build::STATUS_FAILED)) {
if (empty($projects[$project_id][$environment]['failed']) && Build::STATUS_FAILED === $item['status']) {
if (is_null($build)) {
$build = new Build($item);
}