Code cleanup

This commit is contained in:
James Cole
2018-04-02 15:10:40 +02:00
parent fa7ab45a40
commit a3c34e6b3c
151 changed files with 802 additions and 990 deletions

View File

@@ -50,9 +50,6 @@ class RuleRepository implements RuleRepositoryInterface
*
* @return bool
*
* @throws \Exception
* @throws \Exception
* @throws \Exception
*/
public function destroy(Rule $rule): bool
{
@@ -99,7 +96,7 @@ class RuleRepository implements RuleRepositoryInterface
*/
public function getHighestOrderInRuleGroup(RuleGroup $ruleGroup): int
{
return intval($ruleGroup->rules()->max('order'));
return (int)$ruleGroup->rules()->max('order');
}
/**
@@ -261,7 +258,7 @@ class RuleRepository implements RuleRepositoryInterface
$rule->rule_group_id = $data['rule_group_id'];
$rule->order = ($order + 1);
$rule->active = 1;
$rule->stop_processing = 1 === intval($data['stop_processing']);
$rule->stop_processing = 1 === (int)$data['stop_processing'];
$rule->title = $data['title'];
$rule->description = strlen($data['description']) > 0 ? $data['description'] : null;
@@ -290,7 +287,7 @@ class RuleRepository implements RuleRepositoryInterface
$ruleAction->active = 1;
$ruleAction->stop_processing = $values['stopProcessing'];
$ruleAction->action_type = $values['action'];
$ruleAction->action_value = null === $values['value'] ? '' : $values['value'];
$ruleAction->action_value = $values['value'] ?? '';
$ruleAction->save();
return $ruleAction;
@@ -310,7 +307,7 @@ class RuleRepository implements RuleRepositoryInterface
$ruleTrigger->active = 1;
$ruleTrigger->stop_processing = $values['stopProcessing'];
$ruleTrigger->trigger_type = $values['action'];
$ruleTrigger->trigger_value = null === $values['value'] ? '' : $values['value'];
$ruleTrigger->trigger_value = $values['value'] ?? '';
$ruleTrigger->save();
return $ruleTrigger;