Passed
Push — master ( c991d8...c23f05 )
by Sebastian
09:48
created
src/OperationResult.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     * @param string $message Should not contain a date, just the system specific info.
143 143
     * @return OperationResult
144 144
     */
145
-    public function makeSuccess(string $message, int $code=0) : OperationResult
145
+    public function makeSuccess(string $message, int $code = 0) : OperationResult
146 146
     {
147 147
         return $this->setMessage(self::TYPE_SUCCESS, $message, $code, true);
148 148
     }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     * @param string $message Should be as detailed as possible.
154 154
     * @return OperationResult
155 155
     */
156
-    public function makeError(string $message, int $code=0) : OperationResult
156
+    public function makeError(string $message, int $code = 0) : OperationResult
157 157
     {
158 158
         return $this->setMessage(self::TYPE_ERROR, $message, $code, false);
159 159
     }
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
233 233
         return $this->code;
234 234
     }
235 235
     
236
-    public function getMessage(string $type='') : string
236
+    public function getMessage(string $type = '') : string
237 237
     {
238
-        if(!empty($type))
238
+        if (!empty($type))
239 239
         {
240
-            if($this->type === $type)
240
+            if ($this->type === $type)
241 241
             {
242 242
                 return $this->message;
243 243
             }
Please login to merge, or discard this patch.
src/OperationResult/Collection.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -31,27 +31,27 @@  discard block
 block discarded – undo
31 31
     */
32 32
     protected $results = array();
33 33
     
34
-    public function makeError(string $message, int $code=0) : OperationResult
34
+    public function makeError(string $message, int $code = 0) : OperationResult
35 35
     {
36 36
         return $this->add('makeError', $message, $code);
37 37
     }
38 38
     
39
-    public function makeSuccess(string $message, int $code=0) : OperationResult
39
+    public function makeSuccess(string $message, int $code = 0) : OperationResult
40 40
     {
41 41
         return $this->add('makeSuccess', $message, $code);
42 42
     }
43 43
 
44
-    public function makeWarning(string $message, int $code=0) : OperationResult
44
+    public function makeWarning(string $message, int $code = 0) : OperationResult
45 45
     {
46 46
         return $this->add('makeWarning', $message, $code);
47 47
     }
48 48
     
49
-    public function makeNotice(string $message, int $code=0) : OperationResult
49
+    public function makeNotice(string $message, int $code = 0) : OperationResult
50 50
     {
51 51
         return $this->add('makeNotice', $message, $code);
52 52
     }
53 53
     
54
-    protected function add(string $method, string $message, int $code=0) : OperationResult
54
+    protected function add(string $method, string $message, int $code = 0) : OperationResult
55 55
     {
56 56
         $result = new OperationResult($this->subject);
57 57
         $result->$method($message, $code);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     
64 64
     public function addResult(OperationResult $result) : OperationResult_Collection
65 65
     {
66
-        if($result instanceof OperationResult_Collection)
66
+        if ($result instanceof OperationResult_Collection)
67 67
         {
68 68
             return $this->importCollection($result);
69 69
         }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     {
76 76
         $results = $collection->getResults();
77 77
         
78
-        foreach($results as $result)
78
+        foreach ($results as $result)
79 79
         {
80 80
             $this->addResult($result);
81 81
         }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         // the subjects are the same, this is actually the better way.
93 93
         $new = new OperationResult($this->subject);
94 94
         
95
-        if($result->isValid())
95
+        if ($result->isValid())
96 96
         {
97 97
             $new->makeSuccess($result->getSuccessMessage(), $result->getCode());
98 98
         }
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
     
117 117
     public function isValid() : bool
118 118
     {
119
-        foreach($this->results as $result)
119
+        foreach ($this->results as $result)
120 120
         {
121
-            if(!$result->isValid())
121
+            if (!$result->isValid())
122 122
             {
123 123
                 return false;
124 124
             }
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
     
130 130
     public function hasCode() : bool
131 131
     {
132
-        foreach($this->results as $result)
132
+        foreach ($this->results as $result)
133 133
         {
134
-            if($result->hasCode())
134
+            if ($result->hasCode())
135 135
             {
136 136
                 return true;
137 137
             }
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
     
143 143
     public function getCode() : int
144 144
     {
145
-        foreach($this->results as $result)
145
+        foreach ($this->results as $result)
146 146
         {
147
-            if($result->hasCode())
147
+            if ($result->hasCode())
148 148
             {
149 149
                 return $result->getCode();
150 150
             }
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
         return 0;
154 154
     }
155 155
     
156
-    public function getMessage(string $type='') : string
156
+    public function getMessage(string $type = '') : string
157 157
     {
158
-        foreach($this->results as $result)
158
+        foreach ($this->results as $result)
159 159
         {
160 160
             $msg = $result->getMessage($type);
161 161
             
162
-            if(!empty($msg))
162
+            if (!empty($msg))
163 163
             {
164 164
                 return $msg;
165 165
             }
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
     
171 171
     public function containsCode(int $code) : bool
172 172
     {
173
-        foreach($this->results as $result)
173
+        foreach ($this->results as $result)
174 174
         {
175
-            if($result->getCode() === $code)
175
+            if ($result->getCode() === $code)
176 176
             {
177 177
                 return true;
178 178
             }
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
     {
206 206
         $amount = 0;
207 207
         
208
-        foreach($this->results as $result)
208
+        foreach ($this->results as $result)
209 209
         {
210
-            if($result->isType($type))
210
+            if ($result->isType($type))
211 211
             {
212 212
                 $amount++;
213 213
             }
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
     {
246 246
         $results = array();
247 247
         
248
-        foreach($this->results as $result)
248
+        foreach ($this->results as $result)
249 249
         {
250
-            if($result->isType($type))
250
+            if ($result->isType($type))
251 251
             {
252 252
                 $results[] = $result;
253 253
             }
@@ -258,9 +258,9 @@  discard block
 block discarded – undo
258 258
     
259 259
     public function isType(string $type) : bool
260 260
     {
261
-        foreach($this->results as $result)
261
+        foreach ($this->results as $result)
262 262
         {
263
-            if($result->isType($type))
263
+            if ($result->isType($type))
264 264
             {
265 265
                 return true;
266 266
             }
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         $lines[] = 'Collection #'.$this->getID();
277 277
         $lines[] = 'Subject: '.get_class($this->subject);
278 278
         
279
-        foreach($this->results as $result)
279
+        foreach ($this->results as $result)
280 280
         {
281 281
             $lines[] = ' - '.$result->getType().' #'.$result->getCode().' "'.$result->getMessage($result->getType()).'"';
282 282
         }
Please login to merge, or discard this patch.