Passed
Push — master ( 1a0534...bd22ef )
by Sebastian
02:16
created
src/FileHelper/PHPClassInfo.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
     
37 37
     protected $classes = array();
38 38
     
39
-   /**
40
-    * The namespace detected in the file, if any.
41
-    * @var string
42
-    */
39
+    /**
40
+     * The namespace detected in the file, if any.
41
+     * @var string
42
+     */
43 43
     protected $namespace = '';
44 44
     
45
-   /**
46
-    * @param string $path The path to the PHP file to parse.
47
-    * @throws FileHelper_Exception
48
-    * @see FileHelper::findPHPClasses()
49
-    */
45
+    /**
46
+     * @param string $path The path to the PHP file to parse.
47
+     * @throws FileHelper_Exception
48
+     * @see FileHelper::findPHPClasses()
49
+     */
50 50
     public function __construct(string $path)
51 51
     {
52 52
         $this->path = realpath($path);
@@ -66,66 +66,66 @@  discard block
 block discarded – undo
66 66
         $this->parseFile();
67 67
     }
68 68
     
69
-   /**
70
-    * The name of the namespace of the classes in the file, if any.
71
-    * @return string
72
-    */
69
+    /**
70
+     * The name of the namespace of the classes in the file, if any.
71
+     * @return string
72
+     */
73 73
     public function getNamespace() : string
74 74
     {
75 75
         return $this->namespace;
76 76
     }
77 77
     
78
-   /**
79
-    * Whether the file contains a namespace.
80
-    * @return bool
81
-    */
78
+    /**
79
+     * Whether the file contains a namespace.
80
+     * @return bool
81
+     */
82 82
     public function hasNamespace() : bool
83 83
     {
84 84
         return !empty($this->namespace);
85 85
     }
86 86
     
87
-   /**
88
-    * The absolute path to the file.
89
-    * @return string
90
-    */
87
+    /**
88
+     * The absolute path to the file.
89
+     * @return string
90
+     */
91 91
     public function getPath() : string
92 92
     {
93 93
         return $this->path;
94 94
     }
95 95
    
96
-   /**
97
-    * Whether any classes were found in the file.
98
-    * @return bool
99
-    */
96
+    /**
97
+     * Whether any classes were found in the file.
98
+     * @return bool
99
+     */
100 100
     public function hasClasses() : bool
101 101
     {
102 102
         return !empty($this->classes);
103 103
     }
104 104
     
105
-   /**
106
-    * The names of the classes that were found in the file (with namespace if any).
107
-    * @return string[]
108
-    */
105
+    /**
106
+     * The names of the classes that were found in the file (with namespace if any).
107
+     * @return string[]
108
+     */
109 109
     public function getClassNames() : array
110 110
     {
111 111
         return array_keys($this->classes);
112 112
     }
113 113
     
114
-   /**
115
-    * Retrieves all classes that were detected in the file,
116
-    * which can be used to retrieve more information about
117
-    * them.
118
-    * 
119
-    * @return FileHelper_PHPClassInfo_Class[]
120
-    */
114
+    /**
115
+     * Retrieves all classes that were detected in the file,
116
+     * which can be used to retrieve more information about
117
+     * them.
118
+     * 
119
+     * @return FileHelper_PHPClassInfo_Class[]
120
+     */
121 121
     public function getClasses()
122 122
     {
123 123
         return $this->classes;
124 124
     }
125 125
     
126
-   /**
127
-    * @throws FileHelper_Exception
128
-    */
126
+    /**
127
+     * @throws FileHelper_Exception
128
+     */
129 129
     protected function parseFile()
130 130
     {
131 131
         $code = file_get_contents($this->path);
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
         }
181 181
     }
182 182
     
183
-   /**
184
-    * Strips all whitespace from the string, replacing it with 
185
-    * regular spaces (newlines, tabs, etc.).
186
-    * 
187
-    * @param string $string
188
-    * @return string
189
-    */
183
+    /**
184
+     * Strips all whitespace from the string, replacing it with 
185
+     * regular spaces (newlines, tabs, etc.).
186
+     * 
187
+     * @param string $string
188
+     * @return string
189
+     */
190 190
     protected function stripWhitespace(string $string) : string 
191 191
     {
192 192
         return preg_replace('/[\s]/', ' ', $string);
Please login to merge, or discard this patch.
src/FileHelper/PHPClassInfo/Class.php 1 patch
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -22,51 +22,51 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class FileHelper_PHPClassInfo_Class 
24 24
 {
25
-   /**
26
-    * @var FileHelper_PHPClassInfo
27
-    */
25
+    /**
26
+     * @var FileHelper_PHPClassInfo
27
+     */
28 28
     protected $info;
29 29
 
30
-   /**
31
-    * @var bool
32
-    */
30
+    /**
31
+     * @var bool
32
+     */
33 33
     protected $abstract = false;
34 34
     
35
-   /**
36
-    * @var bool
37
-    */
35
+    /**
36
+     * @var bool
37
+     */
38 38
     protected $final = false;
39 39
     
40
-   /**
41
-    * @var string
42
-    */
40
+    /**
41
+     * @var string
42
+     */
43 43
     protected $extends = '';
44 44
     
45
-   /**
46
-    * @var string[]
47
-    */
45
+    /**
46
+     * @var string[]
47
+     */
48 48
     protected $implements = array();
49 49
     
50
-   /**
51
-    * @var string
52
-    */
50
+    /**
51
+     * @var string
52
+     */
53 53
     protected $name;
54 54
     
55
-   /**
56
-    * @var string
57
-    */
55
+    /**
56
+     * @var string
57
+     */
58 58
     protected $declaration;
59 59
     
60
-   /**
61
-    * @var string
62
-    */
60
+    /**
61
+     * @var string
62
+     */
63 63
     protected $keyword;
64 64
     
65
-   /**
66
-    * @param FileHelper_PHPClassInfo $info The class info instance.
67
-    * @param string $declaration The full class declaration, e.g. "class SomeName extends SomeOtherClass".
68
-    * @param string $keyword The class keyword, if any, i.e. "abstract" or "final".
69
-    */
65
+    /**
66
+     * @param FileHelper_PHPClassInfo $info The class info instance.
67
+     * @param string $declaration The full class declaration, e.g. "class SomeName extends SomeOtherClass".
68
+     * @param string $keyword The class keyword, if any, i.e. "abstract" or "final".
69
+     */
70 70
     public function __construct(FileHelper_PHPClassInfo $info, string $declaration, string $keyword)
71 71
     {
72 72
         $this->info = $info;
@@ -76,31 +76,31 @@  discard block
 block discarded – undo
76 76
         $this->analyzeCode();
77 77
     }
78 78
     
79
-   /**
80
-    * Check if this class is a subclass of the specified
81
-    * class name.
82
-    * 
83
-    * @param string $className
84
-    * @return bool
85
-    */
79
+    /**
80
+     * Check if this class is a subclass of the specified
81
+     * class name.
82
+     * 
83
+     * @param string $className
84
+     * @return bool
85
+     */
86 86
     public function isSublassOf(string $className) : bool
87 87
     {
88 88
         return is_subclass_of($this->getNameNS(), $className);
89 89
     }
90 90
     
91
-   /**
92
-    * The class name without namespace.
93
-    * @return string
94
-    */
91
+    /**
92
+     * The class name without namespace.
93
+     * @return string
94
+     */
95 95
     public function getName() : string
96 96
     {
97 97
         return $this->name;
98 98
     }
99 99
     
100
-   /**
101
-    * The absolute class name with namespace (if any).
102
-    * @return string
103
-    */
100
+    /**
101
+     * The absolute class name with namespace (if any).
102
+     * @return string
103
+     */
104 104
     public function getNameNS() : string
105 105
     {
106 106
         $name = $this->getName();
@@ -112,48 +112,48 @@  discard block
 block discarded – undo
112 112
         return $name;
113 113
     }
114 114
     
115
-   /**
116
-    * Whether it is an abstract class.
117
-    * @return bool
118
-    */
115
+    /**
116
+     * Whether it is an abstract class.
117
+     * @return bool
118
+     */
119 119
     public function isAbstract() : bool
120 120
     {
121 121
         return $this->abstract;
122 122
     }
123 123
     
124
-   /**
125
-    * Whether it is a final class.
126
-    * @return bool
127
-    */
124
+    /**
125
+     * Whether it is a final class.
126
+     * @return bool
127
+     */
128 128
     public function isFinal() : bool
129 129
     {
130 130
         return $this->final;
131 131
     }
132 132
 
133
-   /**
134
-    * The name of the class that this class extends (with namespace, if specified).
135
-    * @return string
136
-    */
133
+    /**
134
+     * The name of the class that this class extends (with namespace, if specified).
135
+     * @return string
136
+     */
137 137
     public function getExtends() : string
138 138
     {
139 139
         return $this->extends;
140 140
     }
141 141
     
142
-   /**
143
-    * A list of interfaces the class implements, if any.
144
-    * @return array
145
-    */
142
+    /**
143
+     * A list of interfaces the class implements, if any.
144
+     * @return array
145
+     */
146 146
     public function getImplements() : array
147 147
     {
148 148
         return $this->implements;
149 149
     }
150 150
     
151
-   /**
152
-    * The class declaration string, with normalized spaces and sorted interface names.
153
-    * NOTE: does not include the keyword "abstract" or "final".
154
-    * 
155
-    * @return string
156
-    */
151
+    /**
152
+     * The class declaration string, with normalized spaces and sorted interface names.
153
+     * NOTE: does not include the keyword "abstract" or "final".
154
+     * 
155
+     * @return string
156
+     */
157 157
     public function getDeclaration() : string
158 158
     {
159 159
         $parts = array();
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
         return implode(' ', $parts);
174 174
     }
175 175
     
176
-   /**
177
-    * The keyword before "class", e.g. "abstract".
178
-    * @return string
179
-    */
176
+    /**
177
+     * The keyword before "class", e.g. "abstract".
178
+     * @return string
179
+     */
180 180
     public function getKeyword() : string
181 181
     {
182 182
         return $this->keyword;
Please login to merge, or discard this patch.
examples/URLInfo/highlighting.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
  * @author Sebastian Mordziol <[email protected]>
8 8
  */
9 9
 
10
-   /**
11
-    * Examples environment config
12
-    */
10
+    /**
11
+     * Examples environment config
12
+     */
13 13
     require_once '../prepend.php';
14 14
 
15 15
     use function AppUtils\parseURL;
Please login to merge, or discard this patch.
examples/prepend.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,33 +17,33 @@
 block discarded – undo
17 17
         die('<b>ERROR:</b> Autoloader not present. Run composer update first.');
18 18
     }
19 19
     
20
-   /**
21
-    * The composer autoloader
22
-    */
20
+    /**
21
+     * The composer autoloader
22
+     */
23 23
     require_once $autoload;
24 24
 
25
-   /**
26
-    * Translation global function.
27
-    * @return string
28
-    */
25
+    /**
26
+     * Translation global function.
27
+     * @return string
28
+     */
29 29
     function t()
30 30
     {
31 31
         return call_user_func_array('\AppLocalize\t', func_get_args());
32 32
     }
33 33
     
34
-   /**
35
-    * Translation global function.
36
-    * @return string
37
-    */
34
+    /**
35
+     * Translation global function.
36
+     * @return string
37
+     */
38 38
     function pt()
39 39
     {
40 40
         return call_user_func_array('\AppLocalize\pt', func_get_args());
41 41
     }
42 42
     
43
-   /**
44
-    * Translation global function.
45
-    * @return string
46
-    */
43
+    /**
44
+     * Translation global function.
45
+     * @return string
46
+     */
47 47
     function pts()
48 48
     {
49 49
         return call_user_func_array('\AppLocalize\pts', func_get_args());
Please login to merge, or discard this patch.
src/Request/Param.php 1 patch
Indentation   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
         }
112 112
     }
113 113
     
114
-   /**
115
-    * Adds a callback as a validation method. The callback gets the
116
-    * value to validate as first parameter, and any additional 
117
-    * parameters passed here get appended to that.
118
-    * 
119
-    * The callback must return boolean true or false depending on
120
-    * whether the value is valid.
121
-    * 
122
-    * @param mixed $callback
123
-    * @param array $args
124
-    * @return Request_Param
125
-    */
114
+    /**
115
+     * Adds a callback as a validation method. The callback gets the
116
+     * value to validate as first parameter, and any additional 
117
+     * parameters passed here get appended to that.
118
+     * 
119
+     * The callback must return boolean true or false depending on
120
+     * whether the value is valid.
121
+     * 
122
+     * @param mixed $callback
123
+     * @param array $args
124
+     * @return Request_Param
125
+     */
126 126
     public function setCallback($callback, $args=array())
127 127
     {
128 128
         if(!is_callable($callback)) {
@@ -264,13 +264,13 @@  discard block
 block discarded – undo
264 264
     
265 265
     protected $valueType = self::VALUE_TYPE_STRING;
266 266
 
267
-   /**
268
-    * Sets the variable to contain a comma-separated list of integer IDs.
269
-    * Example: <code>145,248,4556</code>. A single ID is also allowed, e.g.
270
-    * <code>145</code>.
271
-    * 
272
-    * @return Request_Param
273
-    */
267
+    /**
268
+     * Sets the variable to contain a comma-separated list of integer IDs.
269
+     * Example: <code>145,248,4556</code>. A single ID is also allowed, e.g.
270
+     * <code>145</code>.
271
+     * 
272
+     * @return Request_Param
273
+     */
274 274
     public function setIDList()
275 275
     {
276 276
         $this->valueType = self::VALUE_TYPE_ID_LIST;
@@ -279,13 +279,13 @@  discard block
 block discarded – undo
279 279
         return $this;
280 280
     }
281 281
     
282
-   /**
283
-    * Sets the variable to be an alias, as defined by the
284
-    * {@link RegexHelper::REGEX_ALIAS} regular expression.
285
-    * 
286
-    * @return Request_Param
287
-    * @see RegexHelper::REGEX_ALIAS
288
-    */
282
+    /**
283
+     * Sets the variable to be an alias, as defined by the
284
+     * {@link RegexHelper::REGEX_ALIAS} regular expression.
285
+     * 
286
+     * @return Request_Param
287
+     * @see RegexHelper::REGEX_ALIAS
288
+     */
289 289
     public function setAlias()
290 290
     {
291 291
         return $this->setRegex(RegexHelper::REGEX_ALIAS);
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
         return $this->setValidation(self::VALIDATION_TYPE_ALPHA);
327 327
     }
328 328
     
329
-   /**
330
-    * Sets the parameter value as a string containing lowercase
331
-    * and/or uppercase letters, as well as numbers.
332
-    * 
333
-    * @return Request_Param
334
-    */
329
+    /**
330
+     * Sets the parameter value as a string containing lowercase
331
+     * and/or uppercase letters, as well as numbers.
332
+     * 
333
+     * @return Request_Param
334
+     */
335 335
     public function setAlnum()
336 336
     {
337 337
         return $this->setValidation(self::VALIDATION_TYPE_ALNUM);   
@@ -359,17 +359,17 @@  discard block
 block discarded – undo
359 359
         return $this->setValidation(self::VALIDATION_TYPE_ENUM, $args);
360 360
     }
361 361
     
362
-   /**
363
-    * Only available for array values: the parameter must be
364
-    * an array value, and the array may only contain values 
365
-    * specified in the values array.
366
-    * 
367
-    * Submitted values that are not in the allowed list of
368
-    * values are stripped from the value.
369
-    *  
370
-    * @param array $values List of allowed values
371
-    * @return \AppUtils\Request_Param
372
-    */
362
+    /**
363
+     * Only available for array values: the parameter must be
364
+     * an array value, and the array may only contain values 
365
+     * specified in the values array.
366
+     * 
367
+     * Submitted values that are not in the allowed list of
368
+     * values are stripped from the value.
369
+     *  
370
+     * @param array $values List of allowed values
371
+     * @return \AppUtils\Request_Param
372
+     */
373 373
     public function setValuesList(array $values)
374 374
     {
375 375
         $this->setArray();
@@ -382,39 +382,39 @@  discard block
 block discarded – undo
382 382
         return $this->setValidation(self::VALIDATION_TYPE_ARRAY);
383 383
     }
384 384
     
385
-   /**
386
-    * Specifies that a JSON-encoded string is expected.
387
-    * 
388
-    * NOTE: Numbers or quoted strings are technically valid
389
-    * JSON, but are not accepted, because it is assumed
390
-    * at least an array or object are expected.
391
-    * 
392
-    * @return \AppUtils\Request_Param
393
-    */
385
+    /**
386
+     * Specifies that a JSON-encoded string is expected.
387
+     * 
388
+     * NOTE: Numbers or quoted strings are technically valid
389
+     * JSON, but are not accepted, because it is assumed
390
+     * at least an array or object are expected.
391
+     * 
392
+     * @return \AppUtils\Request_Param
393
+     */
394 394
     public function setJSON() : Request_Param
395 395
     {
396 396
         return $this->setValidation(self::VALIDATION_TYPE_JSON, array('arrays' => true));
397 397
     }
398 398
     
399
-   /**
400
-    * Like {@link Request_Param::setJSON()}, but accepts
401
-    * only JSON objects. Arrays will not be accepted.
402
-    * 
403
-    * @return \AppUtils\Request_Param
404
-    */
399
+    /**
400
+     * Like {@link Request_Param::setJSON()}, but accepts
401
+     * only JSON objects. Arrays will not be accepted.
402
+     * 
403
+     * @return \AppUtils\Request_Param
404
+     */
405 405
     public function setJSONObject() : Request_Param
406 406
     {
407 407
         return $this->setValidation(self::VALIDATION_TYPE_JSON, array('arrays' => false));
408 408
     }
409 409
     
410
-   /**
411
-    * The parameter is a string boolean representation. This means
412
-    * it can be any of the following: "yes", "true", "no", "false".
413
-    * The value is automatically converted to a boolean when retrieving
414
-    * the parameter.
415
-    * 
416
-    * @return Request_Param
417
-    */
410
+    /**
411
+     * The parameter is a string boolean representation. This means
412
+     * it can be any of the following: "yes", "true", "no", "false".
413
+     * The value is automatically converted to a boolean when retrieving
414
+     * the parameter.
415
+     * 
416
+     * @return Request_Param
417
+     */
418 418
     public function setBoolean() : Request_Param
419 419
     {
420 420
         $this->addCallbackFilter(array($this, 'applyFilter_boolean'));
@@ -478,15 +478,15 @@  discard block
 block discarded – undo
478 478
         return $keep;
479 479
     }
480 480
     
481
-   /**
482
-    * Validates the request parameter as an MD5 string,
483
-    * so that only values resembling md5 values are accepted.
484
-    * 
485
-    * NOTE: This can only guarantee the format, not whether
486
-    * it is an actual valid hash of something.
487
-    * 
488
-    * @return \AppUtils\Request_Param
489
-    */
481
+    /**
482
+     * Validates the request parameter as an MD5 string,
483
+     * so that only values resembling md5 values are accepted.
484
+     * 
485
+     * NOTE: This can only guarantee the format, not whether
486
+     * it is an actual valid hash of something.
487
+     * 
488
+     * @return \AppUtils\Request_Param
489
+     */
490 490
     public function setMD5() : Request_Param
491 491
     {
492 492
         return $this->setRegex(RegexHelper::REGEX_MD5);
@@ -528,14 +528,14 @@  discard block
 block discarded – undo
528 528
         return $this;
529 529
     }
530 530
     
531
-   /**
532
-    * Retrieves the value of the request parameter,
533
-    * applying all filters (if any) and validation
534
-    * (if any).
535
-    * 
536
-    * @param mixed $default
537
-    * @return mixed
538
-    */
531
+    /**
532
+     * Retrieves the value of the request parameter,
533
+     * applying all filters (if any) and validation
534
+     * (if any).
535
+     * 
536
+     * @param mixed $default
537
+     * @return mixed
538
+     */
539 539
     public function get($default=null)
540 540
     {
541 541
         $value = $this->request->getParam($this->paramName);
@@ -565,12 +565,12 @@  discard block
 block discarded – undo
565 565
         return null;
566 566
     }
567 567
     
568
-   /**
569
-    * Validates the syntax of an URL, but not its actual validity. 
570
-    * 
571
-    * @param mixed $value
572
-    * @return string
573
-    */
568
+    /**
569
+     * Validates the syntax of an URL, but not its actual validity. 
570
+     * 
571
+     * @param mixed $value
572
+     * @return string
573
+     */
574 574
     protected function validate_url($value) : string
575 575
     {
576 576
         if(!is_string($value)) {
@@ -710,10 +710,10 @@  discard block
 block discarded – undo
710 710
         return null;
711 711
     }
712 712
     
713
-   /**
714
-    * Makes sure that the value is a JSON-encoded string.
715
-    * @param string $value
716
-    */
713
+    /**
714
+     * Makes sure that the value is a JSON-encoded string.
715
+     * @param string $value
716
+     */
717 717
     protected function validate_json($value)
718 718
     {
719 719
         if(!is_string($value)) {
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
         if($this->validationParams['arrays'] === false) 
731 731
         {
732 732
             if(is_object(json_decode($value))) {
733
-               return $value; 
733
+                return $value; 
734 734
             }
735 735
         } 
736 736
         else 
@@ -811,12 +811,12 @@  discard block
 block discarded – undo
811 811
         return $this;
812 812
     }
813 813
     
814
-   /**
815
-    * Adds a filter that trims whitespace from the request
816
-    * parameter using the PHP <code>trim</code> function.
817
-    * 
818
-    * @return \AppUtils\Request_Param
819
-    */
814
+    /**
815
+     * Adds a filter that trims whitespace from the request
816
+     * parameter using the PHP <code>trim</code> function.
817
+     * 
818
+     * @return \AppUtils\Request_Param
819
+     */
820 820
     public function addFilterTrim() : Request_Param
821 821
     {
822 822
         // to guarantee we only work with strings
@@ -825,13 +825,13 @@  discard block
 block discarded – undo
825 825
         return $this->addCallbackFilter('trim');
826 826
     }
827 827
 
828
-   /**
829
-    * Converts the value to a string, even if it is not
830
-    * a string value. Complex types like arrays and objects
831
-    * are converted to an empty string.
832
-    * 
833
-    * @return \AppUtils\Request_Param
834
-    */
828
+    /**
829
+     * Converts the value to a string, even if it is not
830
+     * a string value. Complex types like arrays and objects
831
+     * are converted to an empty string.
832
+     * 
833
+     * @return \AppUtils\Request_Param
834
+     */
835 835
     public function addStringFilter() : Request_Param
836 836
     {
837 837
         return $this->addCallbackFilter(array($this, 'applyFilter_string'));
@@ -881,12 +881,12 @@  discard block
 block discarded – undo
881 881
         return $this->addCallbackFilter('strip_tags', array($allowedTags));
882 882
     }
883 883
     
884
-   /**
885
-    * Adds a filter that strips all whitespace from the
886
-    * request parameter, from spaces to tabs and newlines.
887
-    * 
888
-    * @return \AppUtils\Request_Param
889
-    */
884
+    /**
885
+     * Adds a filter that strips all whitespace from the
886
+     * request parameter, from spaces to tabs and newlines.
887
+     * 
888
+     * @return \AppUtils\Request_Param
889
+     */
890 890
     public function addStripWhitespaceFilter() : Request_Param
891 891
     {
892 892
         // to ensure we only work with strings.
@@ -895,14 +895,14 @@  discard block
 block discarded – undo
895 895
         return $this->addCallbackFilter(array($this, 'applyFilter_stripWhitespace'));
896 896
     }   
897 897
     
898
-   /**
899
-    * Adds a filter that transforms comma separated values
900
-    * into an array of values.
901
-    * 
902
-    * @param bool $trimEntries Trim whitespace from each entry?
903
-    * @param bool $stripEmptyEntries Remove empty entries from the array?
904
-    * @return \AppUtils\Request_Param
905
-    */
898
+    /**
899
+     * Adds a filter that transforms comma separated values
900
+     * into an array of values.
901
+     * 
902
+     * @param bool $trimEntries Trim whitespace from each entry?
903
+     * @param bool $stripEmptyEntries Remove empty entries from the array?
904
+     * @return \AppUtils\Request_Param
905
+     */
906 906
     public function addCommaSeparatedFilter(bool $trimEntries=true, bool $stripEmptyEntries=true) : Request_Param
907 907
     {
908 908
         $this->setArray();
@@ -916,12 +916,12 @@  discard block
 block discarded – undo
916 916
         );
917 917
     }
918 918
     
919
-   /**
920
-    * Adds a filter that encodes all HTML special characters
921
-    * using the PHP <code>htmlspecialchars</code> function.
922
-    * 
923
-    * @return \AppUtils\Request_Param
924
-    */
919
+    /**
920
+     * Adds a filter that encodes all HTML special characters
921
+     * using the PHP <code>htmlspecialchars</code> function.
922
+     * 
923
+     * @return \AppUtils\Request_Param
924
+     */
925 925
     public function addHTMLSpecialcharsFilter() : Request_Param
926 926
     {
927 927
         return $this->addCallbackFilter('htmlspecialchars', array(ENT_QUOTES, 'UTF-8'));
@@ -934,14 +934,14 @@  discard block
 block discarded – undo
934 934
     
935 935
     protected $required = false;
936 936
     
937
-   /**
938
-    * Marks this request parameter as required. To use this feature,
939
-    * you have to call the request's {@link Request::validate()}
940
-    * method.
941
-    * 
942
-    * @return Request_Param
943
-    * @see Request::validate()
944
-    */
937
+    /**
938
+     * Marks this request parameter as required. To use this feature,
939
+     * you have to call the request's {@link Request::validate()}
940
+     * method.
941
+     * 
942
+     * @return Request_Param
943
+     * @see Request::validate()
944
+     */
945 945
     public function makeRequired() : Request_Param
946 946
     {
947 947
         $this->required = true;
Please login to merge, or discard this patch.
src/CSVHelper.php 1 patch
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -50,20 +50,20 @@  discard block
 block discarded – undo
50 50
         
51 51
     }
52 52
 
53
-   /**
54
-    * Creates and returns a new instance of the CSV builder which
55
-    * can be used to build CSV from scratch.
56
-    * 
57
-    * @return CSVHelper_Builder
58
-    */
53
+    /**
54
+     * Creates and returns a new instance of the CSV builder which
55
+     * can be used to build CSV from scratch.
56
+     * 
57
+     * @return CSVHelper_Builder
58
+     */
59 59
     public static function createBuilder()
60 60
     {
61 61
         return new CSVHelper_Builder();
62 62
     }
63 63
 
64
-   /**
65
-    * @var string
66
-    */
64
+    /**
65
+     * @var string
66
+     */
67 67
     protected $csv = '';
68 68
     
69 69
     protected $data = array();
@@ -72,16 +72,16 @@  discard block
 block discarded – undo
72 72
     
73 73
     protected $headersPosition = self::HEADERS_NONE;
74 74
     
75
-   /**
76
-    * Loads CSV data from a string. 
77
-    * 
78
-    * Note: Use the {@link hasErrors()} method to 
79
-    * check if the string could be parsed correctly
80
-    * afterwards.
81
-    * 
82
-    * @param string $string
83
-    * @return CSVHelper
84
-    */
75
+    /**
76
+     * Loads CSV data from a string. 
77
+     * 
78
+     * Note: Use the {@link hasErrors()} method to 
79
+     * check if the string could be parsed correctly
80
+     * afterwards.
81
+     * 
82
+     * @param string $string
83
+     * @return CSVHelper
84
+     */
85 85
     public function loadString($string)
86 86
     {
87 87
         // remove any UTF byte order marks that may still be present in the string
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
         return $this;
96 96
     }
97 97
     
98
-   /**
99
-    * Loads CSV data from a file.
100
-    * 
101
-    * Note: Use the {@link hasErrors()} method to 
102
-    * check if the string could be parsed correctly
103
-    * afterwards.
104
-    * 
105
-    * @param string $file
106
-    * @throws FileHelper_Exception
107
-    * @return CSVHelper
108
-    * 
109
-    * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST
110
-    * @see FileHelper::ERROR_CANNOT_READ_FILE_CONTENTS
111
-    */
98
+    /**
99
+     * Loads CSV data from a file.
100
+     * 
101
+     * Note: Use the {@link hasErrors()} method to 
102
+     * check if the string could be parsed correctly
103
+     * afterwards.
104
+     * 
105
+     * @param string $file
106
+     * @throws FileHelper_Exception
107
+     * @return CSVHelper
108
+     * 
109
+     * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST
110
+     * @see FileHelper::ERROR_CANNOT_READ_FILE_CONTENTS
111
+     */
112 112
     public function loadFile(string $file) : CSVHelper
113 113
     {
114 114
         $csv = FileHelper::readContents($file);
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
     
123 123
     protected $rowCount = 0;
124 124
     
125
-   /**
126
-    * Specifies that headers are positioned on top, horizontally.
127
-    * @return CSVHelper
128
-    */
125
+    /**
126
+     * Specifies that headers are positioned on top, horizontally.
127
+     * @return CSVHelper
128
+     */
129 129
     public function setHeadersTop()
130 130
     {
131 131
         return $this->setHeadersPosition(self::HEADERS_TOP);
132 132
     }
133 133
     
134
-   /**
135
-    * Specifies that headers are positioned on the left, vertically.
136
-    * @return CSVHelper
137
-    */
134
+    /**
135
+     * Specifies that headers are positioned on the left, vertically.
136
+     * @return CSVHelper
137
+     */
138 138
     public function setHeadersLeft()
139 139
     {
140 140
         return $this->setHeadersPosition(self::HEADERS_LEFT);
141 141
     }
142 142
     
143
-   /**
144
-    * Specifies that there are no headers in the file (default).
145
-    * @return CSVHelper
146
-    */
143
+    /**
144
+     * Specifies that there are no headers in the file (default).
145
+     * @return CSVHelper
146
+     */
147 147
     public function setHeadersNone()
148 148
     {
149 149
         return $this->setHeadersPosition(self::HEADERS_NONE);
@@ -173,18 +173,18 @@  discard block
 block discarded – undo
173 173
         return false;
174 174
     }
175 175
     
176
-   /**
177
-    * Specifies where the headers are positioned in the
178
-    * CSV, or turns them off entirely. Use the class constants
179
-    * to ensure the value is correct.
180
-    * 
181
-    * @param string $position
182
-    * @throws CSVHelper_Exception
183
-    * @return CSVHelper
184
-    * @see CSVHelper::HEADERS_LEFT
185
-    * @see CSVHelper::HEADERS_TOP
186
-    * @see CSVHelper::HEADERS_NONE
187
-    */
176
+    /**
177
+     * Specifies where the headers are positioned in the
178
+     * CSV, or turns them off entirely. Use the class constants
179
+     * to ensure the value is correct.
180
+     * 
181
+     * @param string $position
182
+     * @throws CSVHelper_Exception
183
+     * @return CSVHelper
184
+     * @see CSVHelper::HEADERS_LEFT
185
+     * @see CSVHelper::HEADERS_TOP
186
+     * @see CSVHelper::HEADERS_NONE
187
+     */
188 188
     public function setHeadersPosition($position)
189 189
     {
190 190
         $validPositions = array(
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
         return $this;
212 212
     }
213 213
     
214
-   /**
215
-    * Resets all internal data, allowing to start entirely anew
216
-    * with a new file, or to start building a new CSV file from
217
-    * scratch.
218
-    * 
219
-    * @return CSVHelper
220
-    */
214
+    /**
215
+     * Resets all internal data, allowing to start entirely anew
216
+     * with a new file, or to start building a new CSV file from
217
+     * scratch.
218
+     * 
219
+     * @return CSVHelper
220
+     */
221 221
     public function reset()
222 222
     {
223 223
         $this->data = array();
@@ -234,19 +234,19 @@  discard block
 block discarded – undo
234 234
         return $this->data;
235 235
     }
236 236
     
237
-   /**
238
-    * Retrieves the row at the specified index.
239
-    * If there is no data at the index, this will
240
-    * return an array populated with empty strings
241
-    * for all available columns.
242
-    * 
243
-    * Tip: Use the {@link rowExists()} method to check
244
-    * whether the specified row exists.
245
-    * 
246
-    * @param integer $index
247
-    * @return array()
248
-    * @see rowExists()
249
-    */
237
+    /**
238
+     * Retrieves the row at the specified index.
239
+     * If there is no data at the index, this will
240
+     * return an array populated with empty strings
241
+     * for all available columns.
242
+     * 
243
+     * Tip: Use the {@link rowExists()} method to check
244
+     * whether the specified row exists.
245
+     * 
246
+     * @param integer $index
247
+     * @return array()
248
+     * @see rowExists()
249
+     */
250 250
     public function getRow($index)
251 251
     {
252 252
         if(isset($this->data[$index])) {
@@ -256,63 +256,63 @@  discard block
 block discarded – undo
256 256
         return array_fill(0, $this->rowCount, '');
257 257
     }
258 258
     
259
-   /**
260
-    * Checks whether the specified row exists in the data set.
261
-    * @param integer $index
262
-    * @return boolean
263
-    */
259
+    /**
260
+     * Checks whether the specified row exists in the data set.
261
+     * @param integer $index
262
+     * @return boolean
263
+     */
264 264
     public function rowExists($index)
265 265
     {
266 266
         return isset($this->data[$index]);
267 267
     }
268 268
     
269
-   /**
270
-    * Counts the amount of rows in the parsed CSV,
271
-    * excluding the headers if any, depending on 
272
-    * their position.
273
-    * 
274
-    * @return integer
275
-    */
269
+    /**
270
+     * Counts the amount of rows in the parsed CSV,
271
+     * excluding the headers if any, depending on 
272
+     * their position.
273
+     * 
274
+     * @return integer
275
+     */
276 276
     public function countRows()
277 277
     {
278 278
         return $this->rowCount;
279 279
     }
280 280
     
281
-   /**
282
-    * Counts the amount of rows in the parsed CSV, 
283
-    * excluding the headers if any, depending on
284
-    * their position.
285
-    * 
286
-    * @return integer
287
-    */
281
+    /**
282
+     * Counts the amount of rows in the parsed CSV, 
283
+     * excluding the headers if any, depending on
284
+     * their position.
285
+     * 
286
+     * @return integer
287
+     */
288 288
     public function countColumns()
289 289
     {
290 290
         return $this->columnCount;
291 291
     }
292 292
     
293
-   /**
294
-    * Retrieves the headers, if any. Specify the position of the
295
-    * headers first to ensure this works correctly.
296
-    * 
297
-    * @return array Indexed array with header names.
298
-    */
293
+    /**
294
+     * Retrieves the headers, if any. Specify the position of the
295
+     * headers first to ensure this works correctly.
296
+     * 
297
+     * @return array Indexed array with header names.
298
+     */
299 299
     public function getHeaders()
300 300
     {
301 301
         return $this->headers;
302 302
     }
303 303
     
304
-   /**
305
-    * Retrieves the column at the specified index. If there
306
-    * is no column at the index, this returns an array
307
-    * populated with empty strings.
308
-    * 
309
-    * Tip: Use the {@link columnExists()} method to check
310
-    * whether a column exists.
311
-    * 
312
-    * @param integer $index
313
-    * @return string[]
314
-    * @see columnExists()
315
-    */
304
+    /**
305
+     * Retrieves the column at the specified index. If there
306
+     * is no column at the index, this returns an array
307
+     * populated with empty strings.
308
+     * 
309
+     * Tip: Use the {@link columnExists()} method to check
310
+     * whether a column exists.
311
+     * 
312
+     * @param integer $index
313
+     * @return string[]
314
+     * @see columnExists()
315
+     */
316 316
     public function getColumn($index)
317 317
     {
318 318
         $data = array();
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
         return $data;
329 329
     }
330 330
     
331
-   /**
332
-    * Checks whether the specified column exists in the data set.
333
-    * @param integer $index
334
-    * @return boolean
335
-    */
331
+    /**
332
+     * Checks whether the specified column exists in the data set.
333
+     * @param integer $index
334
+     * @return boolean
335
+     */
336 336
     public function columnExists($index)
337 337
     {
338 338
         if($index < $this->columnCount) {
@@ -396,22 +396,22 @@  discard block
 block discarded – undo
396 396
         }
397 397
     }
398 398
     
399
-   /**
400
-    * Checks whether any errors have been encountered
401
-    * while parsing the CSV.
402
-    * 
403
-    * @return boolean
404
-    * @see getErrorMessages()
405
-    */
399
+    /**
400
+     * Checks whether any errors have been encountered
401
+     * while parsing the CSV.
402
+     * 
403
+     * @return boolean
404
+     * @see getErrorMessages()
405
+     */
406 406
     public function hasErrors()
407 407
     {
408 408
         return !empty($this->errors);
409 409
     }
410 410
     
411
-   /**
412
-    * Retrieves all error messages.
413
-    * @return array
414
-    */
411
+    /**
412
+     * Retrieves all error messages.
413
+     * @return array
414
+     */
415 415
     public function getErrorMessages()
416 416
     {
417 417
         return $this->errors;
Please login to merge, or discard this patch.
src/Request.php 1 patch
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
         return $this->buildURL($params, $dispatcher);
109 109
     }
110 110
     
111
-   /**
112
-    * Retrieves the name of the current dispatcher script / page.
113
-    * This is made to be extended and implemented in a subclass.
114
-    * 
115
-    * @return string
116
-    */
111
+    /**
112
+     * Retrieves the name of the current dispatcher script / page.
113
+     * This is made to be extended and implemented in a subclass.
114
+     * 
115
+     * @return string
116
+     */
117 117
     public function getDispatcher() : string
118 118
     {
119 119
         return '';
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
         return $this->knownParams[$name];
201 201
     }
202 202
     
203
-   /**
204
-    * Retrieves a previously registered parameter instance.
205
-    * 
206
-    * @param string $name
207
-    * @throws Request_Exception
208
-    * @return Request_Param
209
-    */
203
+    /**
204
+     * Retrieves a previously registered parameter instance.
205
+     * 
206
+     * @param string $name
207
+     * @throws Request_Exception
208
+     * @return Request_Param
209
+     */
210 210
     public function getRegisteredParam(string $name) : Request_Param
211 211
     {
212 212
         if(isset($this->knownParams[$name])) {
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
         );
224 224
     }
225 225
     
226
-   /**
227
-    * Checks whether a parameter with the specified name 
228
-    * has been registered.
229
-    * 
230
-    * @param string $name
231
-    * @return bool
232
-    */
226
+    /**
227
+     * Checks whether a parameter with the specified name 
228
+     * has been registered.
229
+     * 
230
+     * @param string $name
231
+     * @return bool
232
+     */
233 233
     public function hasRegisteredParam(string $name) : bool
234 234
     {
235 235
         return isset($this->knownParams[$name]);
@@ -358,14 +358,14 @@  discard block
 block discarded – undo
358 358
         return false;
359 359
     }
360 360
     
361
-   /**
362
-    * Removes a single parameter from the request.
363
-    * If the parameter has been registered, also
364
-    * removes the registration info.
365
-    * 
366
-    * @param string $name
367
-    * @return Request
368
-    */
361
+    /**
362
+     * Removes a single parameter from the request.
363
+     * If the parameter has been registered, also
364
+     * removes the registration info.
365
+     * 
366
+     * @param string $name
367
+     * @return Request
368
+     */
369 369
     public function removeParam(string $name) : Request
370 370
     {
371 371
         if(isset($_REQUEST[$name])) {
@@ -379,12 +379,12 @@  discard block
 block discarded – undo
379 379
         return $this;
380 380
     }
381 381
     
382
-   /**
383
-    * Removes several parameters from the request.
384
-    * 
385
-    * @param string[] $names
386
-    * @return Request
387
-    */
382
+    /**
383
+     * Removes several parameters from the request.
384
+     * 
385
+     * @param string[] $names
386
+     * @return Request
387
+     */
388 388
     public function removeParams(array $names) : Request
389 389
     {
390 390
         foreach($names as $name) {
@@ -449,18 +449,18 @@  discard block
 block discarded – undo
449 449
         return $val;
450 450
     }
451 451
     
452
-   /**
453
-    * Treats the request parameter as a JSON string, and
454
-    * if it exists and contains valid JSON, returns the
455
-    * decoded JSON value as an array (default).
456
-    *
457
-    * @param string $name
458
-    * @param bool $assoc
459
-    * @return array|object
460
-    * 
461
-    * @see Request::getJSONAssoc()
462
-    * @see Request::getJSONObject()
463
-    */
452
+    /**
453
+     * Treats the request parameter as a JSON string, and
454
+     * if it exists and contains valid JSON, returns the
455
+     * decoded JSON value as an array (default).
456
+     *
457
+     * @param string $name
458
+     * @param bool $assoc
459
+     * @return array|object
460
+     * 
461
+     * @see Request::getJSONAssoc()
462
+     * @see Request::getJSONObject()
463
+     */
464 464
     public function getJSON(string $name, bool $assoc=true)
465 465
     {
466 466
         $value = $this->getParam($name);
@@ -485,13 +485,13 @@  discard block
 block discarded – undo
485 485
         return new \stdClass();
486 486
     }
487 487
     
488
-   /**
489
-    * Like {@link Request::getJSON()}, but omitting the second
490
-    * parameter. Use this for more readable code.
491
-    * 
492
-    * @param string $name
493
-    * @return array
494
-    */
488
+    /**
489
+     * Like {@link Request::getJSON()}, but omitting the second
490
+     * parameter. Use this for more readable code.
491
+     * 
492
+     * @param string $name
493
+     * @return array
494
+     */
495 495
     public function getJSONAssoc(string $name) : array
496 496
     {
497 497
         $result = $this->getJSON($name);
@@ -502,13 +502,13 @@  discard block
 block discarded – undo
502 502
         return array();
503 503
     }
504 504
     
505
-   /**
506
-    * Like {@link Request::getJSON()}, but omitting the second
507
-    * parameter. Use this for more readable code.
508
-    *
509
-    * @param string $name
510
-    * @return object
511
-    */
505
+    /**
506
+     * Like {@link Request::getJSON()}, but omitting the second
507
+     * parameter. Use this for more readable code.
508
+     *
509
+     * @param string $name
510
+     * @return object
511
+     */
512 512
     public function getJSONObject(string $name) : object
513 513
     {
514 514
         $result = $this->getJSON($name, false);
@@ -519,12 +519,12 @@  discard block
 block discarded – undo
519 519
         return new \stdClass();
520 520
     }
521 521
     
522
-   /**
523
-    * Sends a JSON response with the correct headers.
524
-    *
525
-    * @param array|string $data
526
-    * @param bool $exit Whether to exit the script afterwards.
527
-    */
522
+    /**
523
+     * Sends a JSON response with the correct headers.
524
+     *
525
+     * @param array|string $data
526
+     * @param bool $exit Whether to exit the script afterwards.
527
+     */
528 528
     public static function sendJSON($data, bool $exit=true)
529 529
     {
530 530
         $payload = $data;
@@ -544,12 +544,12 @@  discard block
 block discarded – undo
544 544
         }
545 545
     }
546 546
     
547
-   /**
548
-    * Sends HTML to the browser with the correct headers.
549
-    * 
550
-    * @param string $html
551
-    * @param bool $exit Whether to exit the script afterwards.
552
-    */
547
+    /**
548
+     * Sends HTML to the browser with the correct headers.
549
+     * 
550
+     * @param string $html
551
+     * @param bool $exit Whether to exit the script afterwards.
552
+     */
553 553
     public static function sendHTML(string $html, bool $exit=true)
554 554
     {
555 555
         header('Cache-Control: no-cache, must-revalidate');
@@ -564,16 +564,16 @@  discard block
 block discarded – undo
564 564
         }
565 565
     }
566 566
     
567
-   /**
568
-    * Creates a new instance of the URL comparer, which can check 
569
-    * whether the specified URLs match, regardless of the order in 
570
-    * which the query parameters are, if any.
571
-    * 
572
-    * @param string $sourceURL
573
-    * @param string $targetURL
574
-    * @param array $limitParams Whether to limit the comparison to these specific parameter names (if present)
575
-    * @return Request_URLComparer
576
-    */
567
+    /**
568
+     * Creates a new instance of the URL comparer, which can check 
569
+     * whether the specified URLs match, regardless of the order in 
570
+     * which the query parameters are, if any.
571
+     * 
572
+     * @param string $sourceURL
573
+     * @param string $targetURL
574
+     * @param array $limitParams Whether to limit the comparison to these specific parameter names (if present)
575
+     * @return Request_URLComparer
576
+     */
577 577
     public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams=array()) : Request_URLComparer
578 578
     {
579 579
         $comparer = new Request_URLComparer($this, $sourceURL, $targetURL);
@@ -582,10 +582,10 @@  discard block
 block discarded – undo
582 582
         return $comparer;
583 583
     }
584 584
     
585
-   /**
586
-    * Retrieves the full URL that was used to access the current page.
587
-    * @return string
588
-    */
585
+    /**
586
+     * Retrieves the full URL that was used to access the current page.
587
+     * @return string
588
+     */
589 589
     public function getCurrentURL() : string
590 590
     {
591 591
         return $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
Please login to merge, or discard this patch.
src/ConvertHelper/ThrowableInfo.php 1 patch
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -14,49 +14,49 @@  discard block
 block discarded – undo
14 14
     const CONTEXT_COMMAND_LINE = 'cli';
15 15
     const CONTEXT_WEB = 'web';
16 16
     
17
-   /**
18
-    * @var \Throwable
19
-    */
17
+    /**
18
+     * @var \Throwable
19
+     */
20 20
     protected $exception;
21 21
     
22
-   /**
23
-    * @var ConvertHelper_ThrowableInfo_Call[]
24
-    */
22
+    /**
23
+     * @var ConvertHelper_ThrowableInfo_Call[]
24
+     */
25 25
     protected $calls = array();
26 26
     
27
-   /**
28
-    * @var integer
29
-    */
27
+    /**
28
+     * @var integer
29
+     */
30 30
     protected $code;
31 31
     
32
-   /**
33
-    * @var string
34
-    */
32
+    /**
33
+     * @var string
34
+     */
35 35
     protected $message;
36 36
     
37
-   /**
38
-    * @var integer
39
-    */
37
+    /**
38
+     * @var integer
39
+     */
40 40
     protected $callsCount = 0;
41 41
     
42
-   /**
43
-    * @var ConvertHelper_ThrowableInfo
44
-    */
42
+    /**
43
+     * @var ConvertHelper_ThrowableInfo
44
+     */
45 45
     protected $previous;
46 46
     
47
-   /**
48
-    * @var string
49
-    */
47
+    /**
48
+     * @var string
49
+     */
50 50
     protected $referer = '';
51 51
     
52
-   /**
53
-    * @var \DateTime
54
-    */
52
+    /**
53
+     * @var \DateTime
54
+     */
55 55
     protected $date;
56 56
     
57
-   /**
58
-    * @var string
59
-    */
57
+    /**
58
+     * @var string
59
+     */
60 60
     protected $context = self::CONTEXT_WEB;
61 61
     
62 62
     protected function __construct($subject)
@@ -103,16 +103,16 @@  discard block
 block discarded – undo
103 103
         return isset($this->previous);
104 104
     }
105 105
     
106
-   /**
107
-    * Retrieves the information on the previous exception.
108
-    * 
109
-    * NOTE: Throws an exception if there is no previous 
110
-    * exception. Use hasPrevious() first to avoid this.
111
-    * 
112
-    * @throws ConvertHelper_Exception
113
-    * @return ConvertHelper_ThrowableInfo
114
-    * @see ConvertHelper_ThrowableInfo::ERROR_NO_PREVIOUS_EXCEPTION
115
-    */
106
+    /**
107
+     * Retrieves the information on the previous exception.
108
+     * 
109
+     * NOTE: Throws an exception if there is no previous 
110
+     * exception. Use hasPrevious() first to avoid this.
111
+     * 
112
+     * @throws ConvertHelper_Exception
113
+     * @return ConvertHelper_ThrowableInfo
114
+     * @see ConvertHelper_ThrowableInfo::ERROR_NO_PREVIOUS_EXCEPTION
115
+     */
116 116
     public function getPrevious() : ConvertHelper_ThrowableInfo
117 117
     {
118 118
         if(isset($this->previous)) {
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
         return !empty($this->code);
132 132
     }
133 133
     
134
-   /**
135
-    * Improved textonly exception trace.
136
-    */
134
+    /**
135
+     * Improved textonly exception trace.
136
+     */
137 137
     public function toString() : string
138 138
     {
139 139
         $calls = $this->getCalls();
@@ -161,73 +161,73 @@  discard block
 block discarded – undo
161 161
         return $string;
162 162
     }
163 163
     
164
-   /**
165
-    * Retrieves the URL of the page in which the exception
166
-    * was thrown, if applicable: in CLI context, this will
167
-    * return an empty string.
168
-    * 
169
-    * @return string
170
-    */
164
+    /**
165
+     * Retrieves the URL of the page in which the exception
166
+     * was thrown, if applicable: in CLI context, this will
167
+     * return an empty string.
168
+     * 
169
+     * @return string
170
+     */
171 171
     public function getReferer() : string
172 172
     {
173 173
         return $this->referer;
174 174
     }
175 175
     
176
-   /**
177
-    * Whether the exception occurred in a command line context.
178
-    * @return bool
179
-    */
176
+    /**
177
+     * Whether the exception occurred in a command line context.
178
+     * @return bool
179
+     */
180 180
     public function isCommandLine() : bool
181 181
     {
182 182
         return $this->getContext() === self::CONTEXT_COMMAND_LINE;
183 183
     }
184 184
     
185
-   /**
186
-    * Whether the exception occurred during an http request.
187
-    * @return bool
188
-    */
185
+    /**
186
+     * Whether the exception occurred during an http request.
187
+     * @return bool
188
+     */
189 189
     public function isWebRequest() : bool
190 190
     {
191 191
         return $this->getContext() === self::CONTEXT_WEB;
192 192
     }
193 193
     
194
-   /**
195
-    * Retrieves the context identifier, i.e. if the exception
196
-    * occurred in a command line context or regular web request.
197
-    * 
198
-    * @return string
199
-    * 
200
-    * @see ConvertHelper_ThrowableInfo::isCommandLine()
201
-    * @see ConvertHelper_ThrowableInfo::isWebRequest()
202
-    * @see ConvertHelper_ThrowableInfo::CONTEXT_COMMAND_LINE
203
-    * @see ConvertHelper_ThrowableInfo::CONTEXT_WEB
204
-    */
194
+    /**
195
+     * Retrieves the context identifier, i.e. if the exception
196
+     * occurred in a command line context or regular web request.
197
+     * 
198
+     * @return string
199
+     * 
200
+     * @see ConvertHelper_ThrowableInfo::isCommandLine()
201
+     * @see ConvertHelper_ThrowableInfo::isWebRequest()
202
+     * @see ConvertHelper_ThrowableInfo::CONTEXT_COMMAND_LINE
203
+     * @see ConvertHelper_ThrowableInfo::CONTEXT_WEB
204
+     */
205 205
     public function getContext() : string
206 206
     {
207 207
         return $this->context;
208 208
     }
209 209
     
210
-   /**
211
-    * Retrieves the date of the exception, and approximate time:
212
-    * since exceptions do not store time, this is captured the 
213
-    * moment the ThrowableInfo is created.
214
-    * 
215
-    * @return \DateTime
216
-    */
210
+    /**
211
+     * Retrieves the date of the exception, and approximate time:
212
+     * since exceptions do not store time, this is captured the 
213
+     * moment the ThrowableInfo is created.
214
+     * 
215
+     * @return \DateTime
216
+     */
217 217
     public function getDate() : \DateTime
218 218
     {
219 219
         return $this->date;
220 220
     }
221 221
     
222
-   /**
223
-    * Serializes all information on the exception to an
224
-    * associative array. This can be saved (file, database, 
225
-    * session...), and later be restored into a throwable
226
-    * info instance using the fromSerialized() method.
227
-    * 
228
-    * @return array
229
-    * @see ConvertHelper_ThrowableInfo::fromSerialized()
230
-    */
222
+    /**
223
+     * Serializes all information on the exception to an
224
+     * associative array. This can be saved (file, database, 
225
+     * session...), and later be restored into a throwable
226
+     * info instance using the fromSerialized() method.
227
+     * 
228
+     * @return array
229
+     * @see ConvertHelper_ThrowableInfo::fromSerialized()
230
+     */
231 231
     public function serialize() : array
232 232
     {
233 233
         $result = array(
@@ -254,24 +254,24 @@  discard block
 block discarded – undo
254 254
         return $result;
255 255
     }
256 256
 
257
-   /**
258
-    * Sets the maximum folder depth to show in the 
259
-    * file paths, to avoid them being too long.
260
-    * 
261
-    * @param int $depth
262
-    * @return ConvertHelper_ThrowableInfo
263
-    */
257
+    /**
258
+     * Sets the maximum folder depth to show in the 
259
+     * file paths, to avoid them being too long.
260
+     * 
261
+     * @param int $depth
262
+     * @return ConvertHelper_ThrowableInfo
263
+     */
264 264
     public function setFolderDepth(int $depth) : ConvertHelper_ThrowableInfo
265 265
     {
266 266
         return $this->setOption('folder-depth', $depth);
267 267
     }
268 268
     
269
-   /**
270
-    * Retrieves the current folder depth option value.
271
-    * 
272
-    * @return int
273
-    * @see ConvertHelper_ThrowableInfo::setFolderDepth()
274
-    */
269
+    /**
270
+     * Retrieves the current folder depth option value.
271
+     * 
272
+     * @return int
273
+     * @see ConvertHelper_ThrowableInfo::setFolderDepth()
274
+     */
275 275
     public function getFolderDepth() : int
276 276
     {
277 277
         $depth = $this->getOption('folder-depth');
@@ -282,19 +282,19 @@  discard block
 block discarded – undo
282 282
         return 2;
283 283
     }
284 284
     
285
-   /**
286
-    * Retrieves all function calls that led to the error.
287
-    * @return ConvertHelper_ThrowableInfo_Call[]
288
-    */
285
+    /**
286
+     * Retrieves all function calls that led to the error.
287
+     * @return ConvertHelper_ThrowableInfo_Call[]
288
+     */
289 289
     public function getCalls()
290 290
     {
291 291
         return $this->calls;
292 292
     }
293 293
     
294
-   /**
295
-    * Returns the amount of function and method calls in the stack trace.
296
-    * @return int
297
-    */
294
+    /**
295
+     * Returns the amount of function and method calls in the stack trace.
296
+     * @return int
297
+     */
298 298
     public function countCalls() : int
299 299
     {
300 300
         return $this->callsCount;
Please login to merge, or discard this patch.
src/ConvertHelper/EOL.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
     const TYPE_LF = 'LF';
30 30
     const TYPE_CR = 'CR';
31 31
     
32
-   /**
33
-    * @var string
34
-    */
32
+    /**
33
+     * @var string
34
+     */
35 35
     protected $char;
36 36
     
37
-   /**
38
-    * @var string
39
-    */
37
+    /**
38
+     * @var string
39
+     */
40 40
     protected $type;
41 41
     
42
-   /**
43
-    * @var string
44
-    */
42
+    /**
43
+     * @var string
44
+     */
45 45
     protected $description;
46 46
     
47 47
     public function __construct(string $char, string $type, string $description)
@@ -51,33 +51,33 @@  discard block
 block discarded – undo
51 51
         $this->description = $description;
52 52
     }
53 53
     
54
-   /**
55
-    * The actual EOL character.
56
-    * @return string
57
-    */
54
+    /**
55
+     * The actual EOL character.
56
+     * @return string
57
+     */
58 58
     public function getCharacter() : string
59 59
     {
60 60
         return $this->char;
61 61
     }
62 62
     
63
-   /**
64
-    * A more detailed, human readable description of the character.
65
-    * @return string
66
-    */
63
+    /**
64
+     * A more detailed, human readable description of the character.
65
+     * @return string
66
+     */
67 67
     public function getDescription() : string
68 68
     {
69 69
         return $this->description;
70 70
     }
71 71
     
72
-   /**
73
-    * The EOL character type, e.g. "CR+LF", "CR"...
74
-    * @return string
75
-    * 
76
-    * @see ConvertHelper_EOL::TYPE_CR
77
-    * @see ConvertHelper_EOL::TYPE_CRLF
78
-    * @see ConvertHelper_EOL::TYPE_LF
79
-    * @see ConvertHelper_EOL::TYPE_LFCR
80
-    */
72
+    /**
73
+     * The EOL character type, e.g. "CR+LF", "CR"...
74
+     * @return string
75
+     * 
76
+     * @see ConvertHelper_EOL::TYPE_CR
77
+     * @see ConvertHelper_EOL::TYPE_CRLF
78
+     * @see ConvertHelper_EOL::TYPE_LF
79
+     * @see ConvertHelper_EOL::TYPE_LFCR
80
+     */
81 81
     public function getType() : string
82 82
     {
83 83
         return $this->type;
Please login to merge, or discard this patch.