|
@@ -43,14 +43,14 @@ |
|
|
block discarded – undo |
|
43
|
43
|
|
|
44
|
44
|
private $groups = []; |
|
45
|
45
|
|
|
46
|
|
- function __construct(string $what = 'points', string $how = '>', $val = 0, array $groups = []){ |
|
|
46
|
+ function __construct(string $what = 'points', string $how = '>', $val = 0, array $groups = []) { |
|
47
|
47
|
if (!in_array(strtolower($what), ['points', 'score', 'wins', 'draws', 'losses', 'second', 'third', 'team', 'notprogressed', 'progressed'])) throw new \Exception('Trying to filter unexisting type ('.$what.')'); |
|
48
|
48
|
$this->what = strtolower($what); |
|
49
|
49
|
if (!in_array($how, ['>', '<', '>=', '<=', '=', '!='])) throw new \Exception('Trying to filter with unexisting operator ('.$how.')'); |
|
50
|
50
|
$this->how = $how; |
|
51
|
51
|
if (!(gettype($val) === 'integer' && strtolower($what) !== 'team') && !($val instanceof Team && strtolower($what) === 'team')) throw new \Exception('Unsupported filter value type ('.typeof($val).')'); |
|
52
|
52
|
$this->val = $val; |
|
53
|
|
- $this->groups = array_map(function($a) { return $a->getId(); }, array_filter($groups, function($a) {return ($a instanceof Group);})); |
|
|
53
|
+ $this->groups = array_map(function($a) { return $a->getId(); }, array_filter($groups, function($a) {return ($a instanceof Group); })); |
|
54
|
54
|
} |
|
55
|
55
|
public function __toString() { |
|
56
|
56
|
return 'Filter: '.$this->what.' '.($this->what !== 'notprogressed' && $this->what !== 'progressed' ? $this->how.' '.$this->val : ''); |
Please login to merge, or discard this patch.