Completed
Push — master ( 4f1a31...63e51c )
by Tomáš
01:39
created
src/classes/class_team.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -43,70 +43,70 @@
 block discarded – undo
43 43
 		return array_filter($this->groupResults[$groupId], function($k) { return $k !== 'group'; }, ARRAY_FILTER_USE_KEY);
44 44
 	}
45 45
 
46
-	public function addWin(string $groupId = ''){
46
+	public function addWin(string $groupId = '') {
47 47
 		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')');
48 48
 		$this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->winPoints;
49 49
 		$this->sumPoints += $this->groupResults[$groupId]['group']->winPoints;
50 50
 		$this->groupResults[$groupId]['wins']++;
51 51
 		return $this;
52 52
 	}
53
-	public function removeWin(string $groupId = ''){
53
+	public function removeWin(string $groupId = '') {
54 54
 		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')');
55 55
 		$this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->winPoints;
56 56
 		$this->sumPoints -= $this->groupResults[$groupId]['group']->winPoints;
57 57
 		$this->groupResults[$groupId]['wins']--;
58 58
 		return $this;
59 59
 	}
60
-	public function addDraw(string $groupId = ''){
60
+	public function addDraw(string $groupId = '') {
61 61
 		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')');
62 62
 		$this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->drawPoints;
63 63
 		$this->sumPoints += $this->groupResults[$groupId]['group']->drawPoints;
64 64
 		$this->groupResults[$groupId]['draws']++;
65 65
 		return $this;
66 66
 	}
67
-	public function removeDraw(string $groupId = ''){
67
+	public function removeDraw(string $groupId = '') {
68 68
 		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')');
69 69
 		$this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->drawPointsPoints;
70 70
 		$this->sumPoints -= $this->groupResults[$groupId]['group']->drawPoints;
71 71
 		$this->groupResults[$groupId]['draws']--;
72 72
 		return $this;
73 73
 	}
74
-	public function addLoss(string $groupId = ''){
74
+	public function addLoss(string $groupId = '') {
75 75
 		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')');
76 76
 		$this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->lostPoints;
77 77
 		$this->sumPoints += $this->groupResults[$groupId]['group']->lostPoints;
78 78
 		$this->groupResults[$groupId]['losses']++;
79 79
 		return $this;
80 80
 	}
81
-	public function removeLoss(string $groupId = ''){
81
+	public function removeLoss(string $groupId = '') {
82 82
 		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')');
83 83
 		$this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->lostPoints;
84 84
 		$this->sumPoints -= $this->groupResults[$groupId]['group']->lostPoints;
85 85
 		$this->groupResults[$groupId]['losses']--;
86 86
 		return $this;
87 87
 	}
88
-	public function addSecond(string $groupId = ''){
88
+	public function addSecond(string $groupId = '') {
89 89
 		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')');
90 90
 		$this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->secondPoints;
91 91
 		$this->sumPoints += $this->groupResults[$groupId]['group']->secondPoints;
92 92
 		$this->groupResults[$groupId]['second']++;
93 93
 		return $this;
94 94
 	}
95
-	public function removeSecond(string $groupId = ''){
95
+	public function removeSecond(string $groupId = '') {
96 96
 		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')');
97 97
 		$this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->secondPoints;
98 98
 		$this->sumPoints -= $this->groupResults[$groupId]['group']->secondPoints;
99 99
 		$this->groupResults[$groupId]['second']--;
100 100
 		return $this;
101 101
 	}
102
-	public function addThird(string $groupId = ''){
102
+	public function addThird(string $groupId = '') {
103 103
 		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')');
104 104
 		$this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->thirdPoints;
105 105
 		$this->sumPoints += $this->groupResults[$groupId]['group']->thirdPoints;
106 106
 		$this->groupResults[$groupId]['third']++;
107 107
 		return $this;
108 108
 	}
109
-	public function removeThird(string $groupId = ''){
109
+	public function removeThird(string $groupId = '') {
110 110
 		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')');
111 111
 		$this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->thirdPoints;
112 112
 		$this->sumPoints -= $this->groupResults[$groupId]['group']->thirdPoints;
Please login to merge, or discard this patch.
src/classes/class_tournament.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 	private $allowSkip = false;
22 22
 
23
-	function __construct(string $name = ''){
23
+	function __construct(string $name = '') {
24 24
 		$this->name = $name;
25 25
 	}
26 26
 	public function __toString() {
@@ -55,16 +55,16 @@  discard block
 block discarded – undo
55 55
 	public function getCategoryWait() {
56 56
 		return $this->expectedCategoryWait;
57 57
 	}
58
-	public function getTournamentTime(){
58
+	public function getTournamentTime() {
59 59
 		$games = count($this->getGames());
60 60
 		return $games*$this->expectedPlay+$games*$this->expectedGameWait+count($this->getRounds())*$this->expectedRoundWait+count($this->getCategories())*$this->expectedCategoryWait;
61 61
 	}
62 62
 
63
-	public function allowSkip(){
63
+	public function allowSkip() {
64 64
 		$this->allowSkip = true;
65 65
 		return $this;
66 66
 	}
67
-	public function disallowSkip(){
67
+	public function disallowSkip() {
68 68
 		$this->allowSkip = false;
69 69
 		return $this;
70 70
 	}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		return $this->allowSkip;
77 77
 	}
78 78
 
79
-	public function addCategory(Category ...$categories){
79
+	public function addCategory(Category ...$categories) {
80 80
 		foreach ($categories as $category) {
81 81
 			if ($category instanceof Category) $this->categories[] = $category;
82 82
 			else throw new \Exception('Trying to add category which is not an instance of the Category class.');
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 	public function addTeam(...$teams) {
119 119
 		foreach ($teams as $team) {
120
-			if ($team instanceof Team)  {
120
+			if ($team instanceof Team) {
121 121
 				$this->teams[] = $team;
122 122
 			}
123 123
 			elseif (gettype($team) === 'array') {
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
 						if ($a->sumPoints === $b->sumPoints) return ($a->sumScore > $b->sumScore ? -1 : 1);
154 154
 						return ($a->sumPoints > $b->sumPoints ? -1 : 1);
155 155
 					});
156
-					break;}
156
+					break; }
157 157
 				case SCORE:{
158 158
 					uasort($this->teams, function($a, $b) {
159 159
 						if ($a->sumScore === $b->sumScore) return 0;
160 160
 						return ($a->sumScore > $b->sumScore ? -1 : 1);
161 161
 					});
162
-					break;}
162
+					break; }
163 163
 			}
164 164
 		}
165 165
 		return $this->teams;
Please login to merge, or discard this patch.