Passed
Push — master ( 025a78...0027ff )
by Sebastian
03:09
created
src/ConvertHelper/ThrowableInfo.php 3 patches
Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -20,48 +20,48 @@  discard block
 block discarded – undo
20 20
     const CONTEXT_WEB = 'web';
21 21
 
22 22
     /**
23
-    * @var Throwable
24
-    */
23
+     * @var Throwable
24
+     */
25 25
     protected $exception;
26 26
     
27
-   /**
28
-    * @var ConvertHelper_ThrowableInfo_Call[]
29
-    */
27
+    /**
28
+     * @var ConvertHelper_ThrowableInfo_Call[]
29
+     */
30 30
     protected $calls = array();
31 31
     
32
-   /**
33
-    * @var integer
34
-    */
32
+    /**
33
+     * @var integer
34
+     */
35 35
     protected $code = 0;
36 36
     
37
-   /**
38
-    * @var string
39
-    */
37
+    /**
38
+     * @var string
39
+     */
40 40
     protected $message;
41 41
     
42
-   /**
43
-    * @var integer
44
-    */
42
+    /**
43
+     * @var integer
44
+     */
45 45
     protected $callsCount = 0;
46 46
     
47
-   /**
48
-    * @var ConvertHelper_ThrowableInfo
49
-    */
47
+    /**
48
+     * @var ConvertHelper_ThrowableInfo
49
+     */
50 50
     protected $previous;
51 51
     
52
-   /**
53
-    * @var string
54
-    */
52
+    /**
53
+     * @var string
54
+     */
55 55
     protected $referer = '';
56 56
     
57
-   /**
58
-    * @var Microtime
59
-    */
57
+    /**
58
+     * @var Microtime
59
+     */
60 60
     protected $date;
61 61
     
62
-   /**
63
-    * @var string
64
-    */
62
+    /**
63
+     * @var string
64
+     */
65 65
     protected $context = self::CONTEXT_WEB;
66 66
 
67 67
     /**
@@ -127,16 +127,16 @@  discard block
 block discarded – undo
127 127
         return isset($this->previous);
128 128
     }
129 129
     
130
-   /**
131
-    * Retrieves the information on the previous exception.
132
-    * 
133
-    * NOTE: Throws an exception if there is no previous 
134
-    * exception. Use hasPrevious() first to avoid this.
135
-    * 
136
-    * @throws ConvertHelper_Exception
137
-    * @return ConvertHelper_ThrowableInfo
138
-    * @see ConvertHelper_ThrowableInfo::ERROR_NO_PREVIOUS_EXCEPTION
139
-    */
130
+    /**
131
+     * Retrieves the information on the previous exception.
132
+     * 
133
+     * NOTE: Throws an exception if there is no previous 
134
+     * exception. Use hasPrevious() first to avoid this.
135
+     * 
136
+     * @throws ConvertHelper_Exception
137
+     * @return ConvertHelper_ThrowableInfo
138
+     * @see ConvertHelper_ThrowableInfo::ERROR_NO_PREVIOUS_EXCEPTION
139
+     */
140 140
     public function getPrevious() : ConvertHelper_ThrowableInfo
141 141
     {
142 142
         if(isset($this->previous)) {
@@ -155,68 +155,68 @@  discard block
 block discarded – undo
155 155
         return !empty($this->code);
156 156
     }
157 157
     
158
-   /**
159
-    * Improved text-only exception trace.
160
-    */
158
+    /**
159
+     * Improved text-only exception trace.
160
+     */
161 161
     public function toString() : string
162 162
     {
163 163
         return (new ConvertHelper_ThrowableInfo_StringConverter($this))
164 164
             ->toString();
165 165
     }
166 166
     
167
-   /**
168
-    * Retrieves the URL of the page in which the exception
169
-    * was thrown, if applicable: in CLI context, this will
170
-    * return an empty string.
171
-    * 
172
-    * @return string
173
-    */
167
+    /**
168
+     * Retrieves the URL of the page in which the exception
169
+     * was thrown, if applicable: in CLI context, this will
170
+     * return an empty string.
171
+     * 
172
+     * @return string
173
+     */
174 174
     public function getReferer() : string
175 175
     {
176 176
         return $this->referer;
177 177
     }
178 178
     
179
-   /**
180
-    * Whether the exception occurred in a command line context.
181
-    * @return bool
182
-    */
179
+    /**
180
+     * Whether the exception occurred in a command line context.
181
+     * @return bool
182
+     */
183 183
     public function isCommandLine() : bool
184 184
     {
185 185
         return $this->getContext() === self::CONTEXT_COMMAND_LINE;
186 186
     }
187 187
     
188
-   /**
189
-    * Whether the exception occurred during an http request.
190
-    * @return bool
191
-    */
188
+    /**
189
+     * Whether the exception occurred during an http request.
190
+     * @return bool
191
+     */
192 192
     public function isWebRequest() : bool
193 193
     {
194 194
         return $this->getContext() === self::CONTEXT_WEB;
195 195
     }
196 196
     
197
-   /**
198
-    * Retrieves the context identifier, i.e. if the exception
199
-    * occurred in a command line context or regular web request.
200
-    * 
201
-    * @return string
202
-    * 
203
-    * @see ConvertHelper_ThrowableInfo::isCommandLine()
204
-    * @see ConvertHelper_ThrowableInfo::isWebRequest()
205
-    * @see ConvertHelper_ThrowableInfo::CONTEXT_COMMAND_LINE
206
-    * @see ConvertHelper_ThrowableInfo::CONTEXT_WEB
207
-    */
197
+    /**
198
+     * Retrieves the context identifier, i.e. if the exception
199
+     * occurred in a command line context or regular web request.
200
+     * 
201
+     * @return string
202
+     * 
203
+     * @see ConvertHelper_ThrowableInfo::isCommandLine()
204
+     * @see ConvertHelper_ThrowableInfo::isWebRequest()
205
+     * @see ConvertHelper_ThrowableInfo::CONTEXT_COMMAND_LINE
206
+     * @see ConvertHelper_ThrowableInfo::CONTEXT_WEB
207
+     */
208 208
     public function getContext() : string
209 209
     {
210 210
         return $this->context;
211 211
     }
212 212
     
213
-   /**
214
-    * Retrieves the date of the exception, and approximate time:
215
-    * since exceptions do not store time, this is captured the 
216
-    * moment the ThrowableInfo is created.
217
-    * 
218
-    * @return Microtime
219
-    */
213
+    /**
214
+     * Retrieves the date of the exception, and approximate time:
215
+     * since exceptions do not store time, this is captured the 
216
+     * moment the ThrowableInfo is created.
217
+     * 
218
+     * @return Microtime
219
+     */
220 220
     public function getDate() : Microtime
221 221
     {
222 222
         return $this->date;
@@ -237,24 +237,24 @@  discard block
 block discarded – undo
237 237
         return ConvertHelper_ThrowableInfo_Serializer::serialize($this);
238 238
     }
239 239
 
240
-   /**
241
-    * Sets the maximum folder depth to show in the 
242
-    * file paths, to avoid them being too long.
243
-    * 
244
-    * @param int $depth
245
-    * @return ConvertHelper_ThrowableInfo
246
-    */
240
+    /**
241
+     * Sets the maximum folder depth to show in the 
242
+     * file paths, to avoid them being too long.
243
+     * 
244
+     * @param int $depth
245
+     * @return ConvertHelper_ThrowableInfo
246
+     */
247 247
     public function setFolderDepth(int $depth) : ConvertHelper_ThrowableInfo
248 248
     {
249 249
         return $this->setOption('folder-depth', $depth);
250 250
     }
251 251
     
252
-   /**
253
-    * Retrieves the current folder depth option value.
254
-    * 
255
-    * @return int
256
-    * @see ConvertHelper_ThrowableInfo::setFolderDepth()
257
-    */
252
+    /**
253
+     * Retrieves the current folder depth option value.
254
+     * 
255
+     * @return int
256
+     * @see ConvertHelper_ThrowableInfo::setFolderDepth()
257
+     */
258 258
     public function getFolderDepth() : int
259 259
     {
260 260
         $depth = $this->getOption('folder-depth');
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
         return 2;
266 266
     }
267 267
     
268
-   /**
269
-    * Retrieves all function calls that led to the error,
270
-    * ordered from latest to earliest (the first one in
271
-    * the stack is actually the last call).
272
-    *
273
-    * @return ConvertHelper_ThrowableInfo_Call[]
274
-    */
268
+    /**
269
+     * Retrieves all function calls that led to the error,
270
+     * ordered from latest to earliest (the first one in
271
+     * the stack is actually the last call).
272
+     *
273
+     * @return ConvertHelper_ThrowableInfo_Call[]
274
+     */
275 275
     public function getCalls()
276 276
     {
277 277
         return $this->calls;
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
         return $this->calls[0];
288 288
     }
289 289
     
290
-   /**
291
-    * Returns the amount of function and method calls in the stack trace.
292
-    * @return int
293
-    */
290
+    /**
291
+     * Returns the amount of function and method calls in the stack trace.
292
+     * @return int
293
+     */
294 294
     public function countCalls() : int
295 295
     {
296 296
         return $this->callsCount;
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     protected function __construct($subject)
82 82
     {
83
-        if(is_array($subject))
83
+        if (is_array($subject))
84 84
         {
85 85
             $this->parseSerialized($subject);
86 86
         }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     */
140 140
     public function getPrevious() : ConvertHelper_ThrowableInfo
141 141
     {
142
-        if(isset($this->previous)) {
142
+        if (isset($this->previous)) {
143 143
             return $this->previous;
144 144
         }
145 145
         
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     public function getFolderDepth() : int
259 259
     {
260 260
         $depth = $this->getOption('folder-depth');
261
-        if(!empty($depth)) {
261
+        if (!empty($depth)) {
262 262
             return $depth;
263 263
         }
264 264
         
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
         $this->setOptions($serialized[ConvertHelper_ThrowableInfo_Serializer::SERIALIZED_OPTIONS]);
317 317
         
318
-        foreach($serialized[ConvertHelper_ThrowableInfo_Serializer::SERIALIZED_CALLS] as $def)
318
+        foreach ($serialized[ConvertHelper_ThrowableInfo_Serializer::SERIALIZED_CALLS] as $def)
319 319
         {
320 320
             $this->calls[] = ConvertHelper_ThrowableInfo_Call::fromSerialized($this, $def);
321 321
         }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         $this->date = new Microtime();
327 327
         $this->class = get_class($e);
328 328
 
329
-        if($e instanceof BaseException)
329
+        if ($e instanceof BaseException)
330 330
         {
331 331
             $this->details = $e->getDetails();
332 332
         }
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
      * @return string
360 360
      * @throws ConvertHelper_Exception
361 361
      */
362
-    public function renderErrorMessage(bool $withDeveloperInfo=false) : string
362
+    public function renderErrorMessage(bool $withDeveloperInfo = false) : string
363 363
     {
364 364
         return (new ConvertHelper_ThrowableInfo_MessageRenderer($this, $withDeveloperInfo))
365 365
             ->render();
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
         }
436 436
         else
437 437
         {
438
-            $this->message = 'Original error code: [' . $code . ']. ' . $this->message;
438
+            $this->message = 'Original error code: ['.$code.']. '.$this->message;
439 439
         }
440 440
     }
441 441
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,8 +83,7 @@  discard block
 block discarded – undo
83 83
         if(is_array($subject))
84 84
         {
85 85
             $this->parseSerialized($subject);
86
-        }
87
-        else
86
+        } else
88 87
         {
89 88
             $this->parseException($subject);
90 89
         }
@@ -432,8 +431,7 @@  discard block
 block discarded – undo
432 431
         if (is_integer($code))
433 432
         {
434 433
             $this->code = $code;
435
-        }
436
-        else
434
+        } else
437 435
         {
438 436
             $this->message = 'Original error code: [' . $code . ']. ' . $this->message;
439 437
         }
Please login to merge, or discard this patch.
src/ConvertHelper/ThrowableInfo/MessageRenderer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             ->t('Message:')
39 39
             ->add($this->info->getMessage());
40 40
 
41
-        if($this->developerInfo)
41
+        if ($this->developerInfo)
42 42
         {
43 43
             $message
44 44
                 ->eol()
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
                 ->add($finalCall->toString());
47 47
         }
48 48
 
49
-        if($this->developerInfo && $this->info->hasDetails())
49
+        if ($this->developerInfo && $this->info->hasDetails())
50 50
         {
51 51
             $message
52 52
                 ->t('Developer details:')
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
                 ->add($this->info->getDetails());
55 55
         }
56 56
 
57
-        if($this->info->hasPrevious())
57
+        if ($this->info->hasPrevious())
58 58
         {
59 59
             $message
60 60
                 ->eol()
Please login to merge, or discard this patch.
src/ConvertHelper/ThrowableInfo/Serializer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
             self::SERIALIZED_PREVIOUS => null,
40 40
         );
41 41
 
42
-        if($info->hasPrevious())
42
+        if ($info->hasPrevious())
43 43
         {
44 44
             $result[self::SERIALIZED_PREVIOUS] = $info->getPrevious()->serialize();
45 45
         }
46 46
 
47 47
         $calls = $info->getCalls();
48
-        foreach($calls as $call)
48
+        foreach ($calls as $call)
49 49
         {
50 50
             $result[self::SERIALIZED_CALLS][] = $call->serialize();
51 51
         }
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
         $data = self::validateSerializedData($serialized);
64 64
         $data[self::SERIALIZED_PREVIOUS] = self::unserializePrevious($data[self::SERIALIZED_PREVIOUS]);
65 65
 
66
-        if(!isset($data[self::SERIALIZED_CLASS]))
66
+        if (!isset($data[self::SERIALIZED_CLASS]))
67 67
         {
68 68
             $data[self::SERIALIZED_CLASS] = '';
69 69
         }
70 70
 
71
-        if(!isset($data[self::SERIALIZED_DETAILS]))
71
+        if (!isset($data[self::SERIALIZED_DETAILS]))
72 72
         {
73 73
             $data[self::SERIALIZED_DETAILS] = '';
74 74
         }
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
             self::SERIALIZED_CALLS => 'array'
95 95
         );
96 96
 
97
-        foreach($keys as $key => $type)
97
+        foreach ($keys as $key => $type)
98 98
         {
99
-            if(!isset($serialized[$key]) || gettype($serialized[$key]) !== $type)
99
+            if (!isset($serialized[$key]) || gettype($serialized[$key]) !== $type)
100 100
             {
101 101
                 throw self::createTypeException($key, $type);
102 102
             }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
     private static function unserializePrevious(?array $previous) : ?ConvertHelper_ThrowableInfo
122 122
     {
123
-        if(!empty($previous))
123
+        if (!empty($previous))
124 124
         {
125 125
             return ConvertHelper_ThrowableInfo::fromSerialized($previous);
126 126
         }
Please login to merge, or discard this patch.
src/ConvertHelper/ThrowableInfo/StringConverter.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
     public function toString() : string
20 20
     {
21 21
         return
22
-            $this->renderMessage() .
23
-            $this->renderCalls() .
22
+            $this->renderMessage().
23
+            $this->renderCalls().
24 24
             $this->renderPrevious();
25 25
     }
26 26
 
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
 
34 34
         if ($this->info->hasCode())
35 35
         {
36
-            $string .= ' #' . $this->info->getCode();
36
+            $string .= ' #'.$this->info->getCode();
37 37
         }
38 38
 
39 39
         $string .=
40
-            ': ' .
41
-            $this->info->getMessage() .
40
+            ': '.
41
+            $this->info->getMessage().
42 42
             PHP_EOL;
43 43
 
44 44
         return $string;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
         foreach ($calls as $call)
57 57
         {
58
-            $string .= $call->toString() . PHP_EOL;
58
+            $string .= $call->toString().PHP_EOL;
59 59
         }
60 60
 
61 61
         return $string;
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
         }
74 74
 
75 75
         return
76
-            PHP_EOL .
77
-            PHP_EOL .
78
-            'Previous error:' .
79
-            PHP_EOL .
80
-            PHP_EOL .
76
+            PHP_EOL.
77
+            PHP_EOL.
78
+            'Previous error:'.
79
+            PHP_EOL.
80
+            PHP_EOL.
81 81
             $this->info->getPrevious()->toString();
82 82
     }
83 83
 }
Please login to merge, or discard this patch.