Passed
Push — master ( a18c2c...41ea3f )
by Sebastian
02:50
created
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
     public const TYPE_LF = 'LF';
30 30
     public 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
     /**
@@ -56,33 +56,33 @@  discard block
 block discarded – undo
56 56
         $this->description = $description;
57 57
     }
58 58
     
59
-   /**
60
-    * The actual EOL character.
61
-    * @return string
62
-    */
59
+    /**
60
+     * The actual EOL character.
61
+     * @return string
62
+     */
63 63
     public function getCharacter() : string
64 64
     {
65 65
         return $this->char;
66 66
     }
67 67
     
68
-   /**
69
-    * A more detailed, human readable description of the character.
70
-    * @return string
71
-    */
68
+    /**
69
+     * A more detailed, human readable description of the character.
70
+     * @return string
71
+     */
72 72
     public function getDescription() : string
73 73
     {
74 74
         return $this->description;
75 75
     }
76 76
     
77
-   /**
78
-    * The EOL character type, e.g. "CR+LF", "CR"...
79
-    * @return string
80
-    * 
81
-    * @see ConvertHelper_EOL::TYPE_CR
82
-    * @see ConvertHelper_EOL::TYPE_CRLF
83
-    * @see ConvertHelper_EOL::TYPE_LF
84
-    * @see ConvertHelper_EOL::TYPE_LFCR
85
-    */
77
+    /**
78
+     * The EOL character type, e.g. "CR+LF", "CR"...
79
+     * @return string
80
+     * 
81
+     * @see ConvertHelper_EOL::TYPE_CR
82
+     * @see ConvertHelper_EOL::TYPE_CRLF
83
+     * @see ConvertHelper_EOL::TYPE_LF
84
+     * @see ConvertHelper_EOL::TYPE_LFCR
85
+     */
86 86
     public function getType() : string
87 87
     {
88 88
         return $this->type;
Please login to merge, or discard this patch.
src/ConvertHelper/ThrowableInfo/Call.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -10,45 +10,45 @@  discard block
 block discarded – undo
10 10
     public const TYPE_METHOD_CALL = 'method';
11 11
     public const TYPE_SCRIPT_START = 'start';
12 12
     
13
-   /**
14
-    * @var ConvertHelper_ThrowableInfo
15
-    */
13
+    /**
14
+     * @var ConvertHelper_ThrowableInfo
15
+     */
16 16
     protected $info;
17 17
     
18
-   /**
19
-    * @var VariableInfo[]
20
-    */
18
+    /**
19
+     * @var VariableInfo[]
20
+     */
21 21
     protected $args = array();
22 22
     
23
-   /**
24
-    * The source file, if any
25
-    * @var string
26
-    */
23
+    /**
24
+     * The source file, if any
25
+     * @var string
26
+     */
27 27
     protected $file = '';
28 28
     
29
-   /**
30
-    * @var string
31
-    */
29
+    /**
30
+     * @var string
31
+     */
32 32
     protected $class = '';
33 33
     
34
-   /**
35
-    * @var integer
36
-    */
34
+    /**
35
+     * @var integer
36
+     */
37 37
     protected $line = 0;
38 38
     
39
-   /**
40
-    * @var int
41
-    */
39
+    /**
40
+     * @var int
41
+     */
42 42
     protected $position = 1;
43 43
     
44
-   /**
45
-    * @var string
46
-    */
44
+    /**
45
+     * @var string
46
+     */
47 47
     protected $function = '';
48 48
     
49
-   /**
50
-    * @var string
51
-    */
49
+    /**
50
+     * @var string
51
+     */
52 52
     protected $type = self::TYPE_SCRIPT_START;
53 53
 
54 54
     /**
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
         }
80 80
     }
81 81
     
82
-   /**
83
-    * 1-based position of the call in the calls list.
84
-    * @return int
85
-    */
82
+    /**
83
+     * 1-based position of the call in the calls list.
84
+     * @return int
85
+     */
86 86
     public function getPosition() : int
87 87
     {
88 88
         return $this->position;
@@ -93,18 +93,18 @@  discard block
 block discarded – undo
93 93
         return $this->line;
94 94
     }
95 95
     
96
-   /**
97
-    * Whether the call had any arguments.
98
-    * @return bool
99
-    */
96
+    /**
97
+     * Whether the call had any arguments.
98
+     * @return bool
99
+     */
100 100
     public function hasArguments() : bool
101 101
     {
102 102
         return !empty($this->args);
103 103
     }
104 104
     
105
-   /**
106
-    * @return VariableInfo[]
107
-    */
105
+    /**
106
+     * @return VariableInfo[]
107
+     */
108 108
     public function getArguments()
109 109
     {
110 110
         return $this->args;
@@ -244,31 +244,31 @@  discard block
 block discarded – undo
244 244
         return implode(', ', $tokens); 
245 245
     }
246 246
     
247
-   /**
248
-    * Retrieves the type of call: typically a function
249
-    * call, or a method call of an object. Note that the
250
-    * first call in a script does not have either.
251
-    * 
252
-    * @return string
253
-    * 
254
-    * @see ConvertHelper_ThrowableInfo_Call::TYPE_FUNCTION_CALL
255
-    * @see ConvertHelper_ThrowableInfo_Call::TYPE_METHOD_CALL
256
-    * @see ConvertHelper_ThrowableInfo_Call::TYPE_SCRIPT_START
257
-    * @see ConvertHelper_ThrowableInfo_Call::hasFunction()
258
-    * @see ConvertHelper_ThrowableInfo_Call::hasClass()
259
-    */
247
+    /**
248
+     * Retrieves the type of call: typically a function
249
+     * call, or a method call of an object. Note that the
250
+     * first call in a script does not have either.
251
+     * 
252
+     * @return string
253
+     * 
254
+     * @see ConvertHelper_ThrowableInfo_Call::TYPE_FUNCTION_CALL
255
+     * @see ConvertHelper_ThrowableInfo_Call::TYPE_METHOD_CALL
256
+     * @see ConvertHelper_ThrowableInfo_Call::TYPE_SCRIPT_START
257
+     * @see ConvertHelper_ThrowableInfo_Call::hasFunction()
258
+     * @see ConvertHelper_ThrowableInfo_Call::hasClass()
259
+     */
260 260
     public function getType() : string
261 261
     {
262 262
         return $this->type;
263 263
     }
264 264
      
265
-   /**
266
-    * Serializes the call to an array, with all
267
-    * necessary information. Can be used to restore
268
-    * the call later using {@link ConvertHelper_ThrowableInfo_Call::fromSerialized()}.
269
-    * 
270
-    * @return array<string,mixed>
271
-    */
265
+    /**
266
+     * Serializes the call to an array, with all
267
+     * necessary information. Can be used to restore
268
+     * the call later using {@link ConvertHelper_ThrowableInfo_Call::fromSerialized()}.
269
+     * 
270
+     * @return array<string,mixed>
271
+     */
272 272
     public function serialize() : array
273 273
     {
274 274
         $result = array(
Please login to merge, or discard this patch.
src/ConvertHelper/DurationConverter.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -34,39 +34,39 @@  discard block
 block discarded – undo
34 34
     public const SECONDS_PER_MONTH_APPROX = 2505600; // imprecise - for 29 days, only for approximations. 
35 35
     public const SECONDS_PER_YEAR = 31536000;
36 36
     
37
-   /**
38
-    * @var int|NULL
39
-    */
37
+    /**
38
+     * @var int|NULL
39
+     */
40 40
     protected $dateFrom;
41 41
     
42
-   /**
43
-    * @var int|NULL
44
-    */
42
+    /**
43
+     * @var int|NULL
44
+     */
45 45
     protected $dateTo;
46 46
     
47
-   /**
48
-    * @var bool
49
-    */
47
+    /**
48
+     * @var bool
49
+     */
50 50
     protected $future = false;
51 51
     
52
-   /**
53
-    * @var string
54
-    */
52
+    /**
53
+     * @var string
54
+     */
55 55
     protected $interval = '';
56 56
     
57
-   /**
58
-    * @var int
59
-    */
57
+    /**
58
+     * @var int
59
+     */
60 60
     protected $difference = 0;
61 61
     
62
-   /**
63
-    * @var int
64
-    */
62
+    /**
63
+     * @var int
64
+     */
65 65
     protected $dateDiff = 0;
66 66
     
67
-   /**
68
-    * @var array<string,array<string,string>>|NULL
69
-    */
67
+    /**
68
+     * @var array<string,array<string,string>>|NULL
69
+     */
70 70
     protected static $texts = null;
71 71
     
72 72
     public function __construct()
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
         self::$texts = null;
87 87
     }
88 88
     
89
-   /**
90
-    * Sets the origin date to calculate from.
91
-    * 
92
-    * NOTE: if this is further in the future than
93
-    * the to: date, it will be considered as a 
94
-    * calculation for something to come, i.e. 
95
-    * "In two days".
96
-    *  
97
-    * @param DateTime $date
98
-    * @return ConvertHelper_DurationConverter
99
-    */
89
+    /**
90
+     * Sets the origin date to calculate from.
91
+     * 
92
+     * NOTE: if this is further in the future than
93
+     * the to: date, it will be considered as a 
94
+     * calculation for something to come, i.e. 
95
+     * "In two days".
96
+     *  
97
+     * @param DateTime $date
98
+     * @return ConvertHelper_DurationConverter
99
+     */
100 100
     public function setDateFrom(DateTime $date) : ConvertHelper_DurationConverter
101 101
     {
102 102
         $this->dateFrom = ConvertHelper::date2timestamp($date);
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
         return $this;
105 105
     }
106 106
     
107
-   /**
108
-    * Sets the date to calculate to. Defaults to 
109
-    * the current time if not set.
110
-    * 
111
-    * @param DateTime $date
112
-    * @return ConvertHelper_DurationConverter
113
-    */
107
+    /**
108
+     * Sets the date to calculate to. Defaults to 
109
+     * the current time if not set.
110
+     * 
111
+     * @param DateTime $date
112
+     * @return ConvertHelper_DurationConverter
113
+     */
114 114
     public function setDateTo(DateTime $date) : ConvertHelper_DurationConverter
115 115
     {
116 116
         $this->dateTo = ConvertHelper::date2timestamp($date);
@@ -118,14 +118,14 @@  discard block
 block discarded – undo
118 118
         return $this;
119 119
     }
120 120
     
121
-   /**
122
-    * Converts the specified dates to a human-readable string.
123
-    * 
124
-    * @throws ConvertHelper_Exception
125
-    * @return string
126
-    * 
127
-    * @see ConvertHelper_DurationConverter::ERROR_NO_DATE_FROM_SET
128
-    */
121
+    /**
122
+     * Converts the specified dates to a human-readable string.
123
+     * 
124
+     * @throws ConvertHelper_Exception
125
+     * @return string
126
+     * 
127
+     * @see ConvertHelper_DurationConverter::ERROR_NO_DATE_FROM_SET
128
+     */
129 129
     public function convert() : string
130 130
     {
131 131
         $this->initTexts();
Please login to merge, or discard this patch.
src/ConvertHelper/SizeNotation.php 1 patch
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
     
32 32
     public const VALIDATION_ERROR_NEGATIVE_VALUE = 43803;
33 33
     
34
-   /**
35
-    * @var string
36
-    */
34
+    /**
35
+     * @var string
36
+     */
37 37
     protected $sizeString;
38 38
 
39 39
     /**
@@ -41,44 +41,44 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected $sizeDefinition;
43 43
     
44
-   /**
45
-    * @var integer
46
-    */
44
+    /**
45
+     * @var integer
46
+     */
47 47
     protected $bytes = 0;
48 48
     
49
-   /**
50
-    * @var bool
51
-    */
49
+    /**
50
+     * @var bool
51
+     */
52 52
     protected $valid = true;
53 53
     
54
-   /**
55
-    * @var string
56
-    */
54
+    /**
55
+     * @var string
56
+     */
57 57
     protected $units = null;
58 58
     
59
-   /**
60
-    * @var string
61
-    */
59
+    /**
60
+     * @var string
61
+     */
62 62
     protected $number = '';
63 63
     
64
-   /**
65
-    * @var string
66
-    */
64
+    /**
65
+     * @var string
66
+     */
67 67
     protected $errorMessage = '';
68 68
     
69
-   /**
70
-    * @var int
71
-    */
69
+    /**
70
+     * @var int
71
+     */
72 72
     protected $errorCode = 0;
73 73
     
74
-   /**
75
-    * Create a new instance for the specified size string.
76
-    * 
77
-    * @param string $sizeString A size notation in the format "50 MB", or a number of bytes without units. Spaces are ignored, so "50MB" = "50 MB" = "  50   MB   ". Floating point values are accepted, both with dot and comma notation ("50.5" = "50,5"). To use Base 2 values, ose appropriate units, e.g. "50 MiB", "1.5 GiB". The units are case-insensitive, so "50 MB" = "50 mb".
78
-    *
79
-    * @throws ConvertHelper_Exception
80
-    * @see ConvertHelper_StorageSizeEnum::ERROR_UNKNOWN_UNIT_NAME
81
-    */
74
+    /**
75
+     * Create a new instance for the specified size string.
76
+     * 
77
+     * @param string $sizeString A size notation in the format "50 MB", or a number of bytes without units. Spaces are ignored, so "50MB" = "50 MB" = "  50   MB   ". Floating point values are accepted, both with dot and comma notation ("50.5" = "50,5"). To use Base 2 values, ose appropriate units, e.g. "50 MiB", "1.5 GiB". The units are case-insensitive, so "50 MB" = "50 mb".
78
+     *
79
+     * @throws ConvertHelper_Exception
80
+     * @see ConvertHelper_StorageSizeEnum::ERROR_UNKNOWN_UNIT_NAME
81
+     */
82 82
     public function __construct(string $sizeString)
83 83
     {
84 84
         $this->sizeString = $this->cleanString($sizeString);
@@ -86,31 +86,31 @@  discard block
 block discarded – undo
86 86
         $this->convert();
87 87
     }
88 88
     
89
-   /**
90
-    * Gets the amount of bytes contained in the size notation.
91
-    * @return int
92
-    */
89
+    /**
90
+     * Gets the amount of bytes contained in the size notation.
91
+     * @return int
92
+     */
93 93
     public function toBytes() : int
94 94
     {
95 95
         return $this->bytes;
96 96
     }
97 97
     
98
-   /**
99
-    * Converts the size notation to a human-readable string, e.g. "50 MB".
100
-    * 
101
-    * @param int $precision
102
-    * @return string
103
-    * @see ConvertHelper::bytes2readable()
104
-    */
98
+    /**
99
+     * Converts the size notation to a human-readable string, e.g. "50 MB".
100
+     * 
101
+     * @param int $precision
102
+     * @return string
103
+     * @see ConvertHelper::bytes2readable()
104
+     */
105 105
     public function toString(int $precision=1) : string
106 106
     {
107 107
         return ConvertHelper::bytes2readable($this->bytes, $precision, $this->getBase());
108 108
     }
109 109
     
110
-   /**
111
-    * Retrieves the detected number's base.
112
-    * @return int The base number (1000 for Base 10, or 1024 for Base 2), or 0 if it is not valid.
113
-    */
110
+    /**
111
+     * Retrieves the detected number's base.
112
+     * @return int The base number (1000 for Base 10, or 1024 for Base 2), or 0 if it is not valid.
113
+     */
114 114
     public function getBase() : int
115 115
     {
116 116
         if($this->isValid()) {
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
         return 0;
121 121
     }
122 122
     
123
-   /**
124
-    * Retrieves the detected storage size instance, if 
125
-    * the size string is valid.
126
-    * 
127
-    * @return ConvertHelper_StorageSizeEnum_Size|NULL
128
-    * @see ConvertHelper_StorageSizeEnum_Size
129
-    */
123
+    /**
124
+     * Retrieves the detected storage size instance, if 
125
+     * the size string is valid.
126
+     * 
127
+     * @return ConvertHelper_StorageSizeEnum_Size|NULL
128
+     * @see ConvertHelper_StorageSizeEnum_Size
129
+     */
130 130
     public function getSizeDefinition() : ?ConvertHelper_StorageSizeEnum_Size
131 131
     {
132 132
         if($this->isValid()) {
@@ -136,27 +136,27 @@  discard block
 block discarded – undo
136 136
         return null;
137 137
     }
138 138
     
139
-   /**
140
-    * Checks whether the size notation was valid and could be parsed
141
-    * into a meaningful byte value. If this returns `false`, it is 
142
-    * possible to use the `getErrorXXX` methods to retrieve information
143
-    * on what went wrong. 
144
-    * 
145
-    * @return bool
146
-    * @see ConvertHelper_SizeNotation::getErrorMessage()
147
-    * @see ConvertHelper_SizeNotation::getErrorCode()
148
-    */
139
+    /**
140
+     * Checks whether the size notation was valid and could be parsed
141
+     * into a meaningful byte value. If this returns `false`, it is 
142
+     * possible to use the `getErrorXXX` methods to retrieve information
143
+     * on what went wrong. 
144
+     * 
145
+     * @return bool
146
+     * @see ConvertHelper_SizeNotation::getErrorMessage()
147
+     * @see ConvertHelper_SizeNotation::getErrorCode()
148
+     */
149 149
     public function isValid() : bool
150 150
     {
151 151
         return $this->valid;
152 152
     }
153 153
     
154
-   /**
155
-    * Retrieves the error message if the size notation validation failed.
156
-    * 
157
-    * @return string
158
-    * @see ConvertHelper_SizeNotation::getErrorCode()
159
-    */
154
+    /**
155
+     * Retrieves the error message if the size notation validation failed.
156
+     * 
157
+     * @return string
158
+     * @see ConvertHelper_SizeNotation::getErrorCode()
159
+     */
160 160
     public function getErrorMessage() : string
161 161
     {
162 162
         return $this->errorMessage;
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
         );
202 202
     }
203 203
     
204
-   /**
205
-    * Detects the units and the number in the size notation string.
206
-    * Populates the `units` and `number` properties.
207
-    * 
208
-    * @return bool Whether the string could be parsed successfully.
209
-    */
204
+    /**
205
+     * Detects the units and the number in the size notation string.
206
+     * Populates the `units` and `number` properties.
207
+     * 
208
+     * @return bool Whether the string could be parsed successfully.
209
+     */
210 210
     protected function detectParts() : bool
211 211
     {
212 212
         $units = ConvertHelper_StorageSizeEnum::getSizeNames();
@@ -242,16 +242,16 @@  discard block
 block discarded – undo
242 242
         return true;
243 243
     }
244 244
     
245
-   /**
246
-    * If the validation fails, this is used to store the reason for retrieval later.
247
-    *  
248
-    * @param string $message
249
-    * @param int $code
250
-    * 
251
-    * @see ConvertHelper_SizeNotation::isValid()
252
-    * @see ConvertHelper_SizeNotation::getErrorMessage()
253
-    * @see ConvertHelper_SizeNotation::getErrorCode()
254
-    */
245
+    /**
246
+     * If the validation fails, this is used to store the reason for retrieval later.
247
+     *  
248
+     * @param string $message
249
+     * @param int $code
250
+     * 
251
+     * @see ConvertHelper_SizeNotation::isValid()
252
+     * @see ConvertHelper_SizeNotation::getErrorMessage()
253
+     * @see ConvertHelper_SizeNotation::getErrorCode()
254
+     */
255 255
     protected function setError(string $message, int $code) : void
256 256
     {
257 257
         $this->valid = false;
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
         $this->errorCode = $code;
260 260
     }
261 261
     
262
-   /**
263
-    * Retrieves the error code, if the size notation validation failed.
264
-    * 
265
-    * @return int
266
-    * @see ConvertHelper_SizeNotation::getErrorMessage()
267
-    */
262
+    /**
263
+     * Retrieves the error code, if the size notation validation failed.
264
+     * 
265
+     * @return int
266
+     * @see ConvertHelper_SizeNotation::getErrorMessage()
267
+     */
268 268
     public function getErrorCode() : int
269 269
     {
270 270
         return $this->errorCode;
Please login to merge, or discard this patch.
src/ConvertHelper/IntervalConverter.php 1 patch
Indentation   +38 added lines, -39 removed lines patch added patch discarded remove patch
@@ -17,21 +17,20 @@  discard block
 block discarded – undo
17 17
  * @package Application Utils
18 18
  * @subpackage ConvertHelper
19 19
  * @author Sebastian Mordziol <[email protected]>
20
-
21 20
  * @see ConvertHelper::interval2string()
22 21
  */
23 22
 class ConvertHelper_IntervalConverter
24 23
 {
25 24
     public const ERROR_MISSING_TRANSLATION = 43501;
26 25
     
27
-   /**
28
-    * @var array<string,string>|NULL
29
-    */
26
+    /**
27
+     * @var array<string,string>|NULL
28
+     */
30 29
     protected static $texts = null;
31 30
     
32
-   /**
33
-    * @var string[]
34
-    */
31
+    /**
32
+     * @var string[]
33
+     */
35 34
     protected $tokens = array('y', 'm', 'd', 'h', 'i', 's');
36 35
     
37 36
     public function __construct()
@@ -41,25 +40,25 @@  discard block
 block discarded – undo
41 40
         }
42 41
     }
43 42
     
44
-   /**
45
-    * Called whenever the application locale has changed,
46
-    * to reset the internal translation cache.
47
-    */
43
+    /**
44
+     * Called whenever the application locale has changed,
45
+     * to reset the internal translation cache.
46
+     */
48 47
     public function handle_localeChanged() : void
49 48
     {
50 49
         self::$texts = null;
51 50
     }
52 51
     
53
-   /**
54
-    * Converts the specified interval to a human-readable
55
-    * string, e.g. "2 hours and 4 minutes".
56
-    * 
57
-    * @param \DateInterval $interval
58
-    * @return string
59
-    * @throws ConvertHelper_Exception
60
-    * 
61
-    * @see ConvertHelper_IntervalConverter::ERROR_MISSING_TRANSLATION
62
-    */
52
+    /**
53
+     * Converts the specified interval to a human-readable
54
+     * string, e.g. "2 hours and 4 minutes".
55
+     * 
56
+     * @param \DateInterval $interval
57
+     * @return string
58
+     * @throws ConvertHelper_Exception
59
+     * 
60
+     * @see ConvertHelper_IntervalConverter::ERROR_MISSING_TRANSLATION
61
+     */
63 62
     public function toString(\DateInterval $interval) : string
64 63
     {
65 64
         $this->initTexts();
@@ -88,14 +87,14 @@  discard block
 block discarded – undo
88 87
         return t('%1$s and %2$s', implode(', ', $parts), $last);
89 88
     }
90 89
     
91
-   /**
92
-    * Translates the selected time token, e.g. "y" (for year).
93
-    * 
94
-    * @param string $token
95
-    * @param ConvertHelper_DateInterval $interval
96
-    * @throws ConvertHelper_Exception
97
-    * @return string
98
-    */
90
+    /**
91
+     * Translates the selected time token, e.g. "y" (for year).
92
+     * 
93
+     * @param string $token
94
+     * @param ConvertHelper_DateInterval $interval
95
+     * @throws ConvertHelper_Exception
96
+     * @return string
97
+     */
99 98
     protected function translateToken(string $token, ConvertHelper_DateInterval $interval) : string
100 99
     {
101 100
         $value = $interval->getToken($token);
@@ -123,13 +122,13 @@  discard block
 block discarded – undo
123 122
         );
124 123
     }
125 124
     
126
-   /**
127
-    * Resolves all time tokens that need to be translated in
128
-    * the subject interval, depending on its length.
129
-    * 
130
-    * @param ConvertHelper_DateInterval $interval
131
-    * @return string[]
132
-    */
125
+    /**
126
+     * Resolves all time tokens that need to be translated in
127
+     * the subject interval, depending on its length.
128
+     * 
129
+     * @param ConvertHelper_DateInterval $interval
130
+     * @return string[]
131
+     */
133 132
     protected function resolveTokens(ConvertHelper_DateInterval $interval) : array
134 133
     {
135 134
         $offset = 0;
@@ -147,9 +146,9 @@  discard block
 block discarded – undo
147 146
         return array();
148 147
     }
149 148
     
150
-   /**
151
-    * Initializes the translateable strings.
152
-    */
149
+    /**
150
+     * Initializes the translateable strings.
151
+     */
153 152
     protected function initTexts() : void
154 153
     {
155 154
         if(isset(self::$texts)) {
Please login to merge, or discard this patch.
src/ConvertHelper/StorageSizeEnum.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -30,17 +30,17 @@  discard block
 block discarded – undo
30 30
     public const BASE_10 = 1000;
31 31
     public const BASE_2 = 1024;
32 32
     
33
-   /**
34
-    * @var array<string,ConvertHelper_StorageSizeEnum_Size>
35
-    */
33
+    /**
34
+     * @var array<string,ConvertHelper_StorageSizeEnum_Size>
35
+     */
36 36
     protected static $sizes = array();
37 37
     
38
-   /**
39
-    * Initializes the supported unit notations, and
40
-    * how they are supposed to be calculated.
41
-    *
42
-    * @see ConvertHelper_SizeNotation::parseSize()
43
-    */
38
+    /**
39
+     * Initializes the supported unit notations, and
40
+     * how they are supposed to be calculated.
41
+     *
42
+     * @see ConvertHelper_SizeNotation::parseSize()
43
+     */
44 44
     protected static function init() : void
45 45
     {
46 46
         if(!empty(self::$sizes)) {
@@ -67,28 +67,28 @@  discard block
 block discarded – undo
67 67
         }
68 68
     }
69 69
     
70
-   /**
71
-    * Called whenever the application locale is changed,
72
-    * to reset the size definitions so the labels get 
73
-    * translated to the new locale.
74
-    */
70
+    /**
71
+     * Called whenever the application locale is changed,
72
+     * to reset the size definitions so the labels get 
73
+     * translated to the new locale.
74
+     */
75 75
     public static function handle_localeChanged() : void
76 76
     {
77 77
         self::$sizes = array();
78 78
     }
79 79
     
80
-   /**
81
-    * Adds a storage size to the internal collection.
82
-    * 
83
-    * @param string $name The lowercase size name, e.g. "kb", "mib"
84
-    * @param int $base This defines how many bytes there are in a kilobyte, to differentiate with the two common way to calculate sizes: base 10 or base 2. See the Wikipedia link for more details.
85
-    * @param int $exponent The multiplier of the base to get the byte value
86
-    * @param string $suffix The localized short suffix, e.g. "KB", "MiB"
87
-    * @param string $singular The localized singular label of the size, e.g. "Kilobyte".
88
-    * @param string $plural The localized plural label of the size, e.g. "Kilobytes".
89
-    * 
90
-    * @see https://en.m.wikipedia.org/wiki/Megabyte#Definitions
91
-    */
80
+    /**
81
+     * Adds a storage size to the internal collection.
82
+     * 
83
+     * @param string $name The lowercase size name, e.g. "kb", "mib"
84
+     * @param int $base This defines how many bytes there are in a kilobyte, to differentiate with the two common way to calculate sizes: base 10 or base 2. See the Wikipedia link for more details.
85
+     * @param int $exponent The multiplier of the base to get the byte value
86
+     * @param string $suffix The localized short suffix, e.g. "KB", "MiB"
87
+     * @param string $singular The localized singular label of the size, e.g. "Kilobyte".
88
+     * @param string $plural The localized plural label of the size, e.g. "Kilobytes".
89
+     * 
90
+     * @see https://en.m.wikipedia.org/wiki/Megabyte#Definitions
91
+     */
92 92
     protected static function addSize(string $name, int $base, int $exponent, string $suffix, string $singular, string $plural) : void
93 93
     {
94 94
         self::$sizes[$name] = new ConvertHelper_StorageSizeEnum_Size(
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
         );
102 102
     }
103 103
     
104
-   /**
105
-    * Retrieves all known sizes.
106
-    * 
107
-    * @return ConvertHelper_StorageSizeEnum_Size[]
108
-    */
104
+    /**
105
+     * Retrieves all known sizes.
106
+     * 
107
+     * @return ConvertHelper_StorageSizeEnum_Size[]
108
+     */
109 109
     public static function getSizes() : array
110 110
     {
111 111
         self::init();
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
         return array_values(self::$sizes);
114 114
     }
115 115
     
116
-   /**
117
-    * Retrieves a size definition instance by its name.
118
-    * 
119
-    * @param string $name Case-insensitive. For example "kb", "MiB"...
120
-    * @throws ConvertHelper_Exception
121
-    * @return ConvertHelper_StorageSizeEnum_Size
122
-    * 
123
-    * @see ConvertHelper_StorageSizeEnum::ERROR_UNKNOWN_UNIT_NAME
124
-    */
116
+    /**
117
+     * Retrieves a size definition instance by its name.
118
+     * 
119
+     * @param string $name Case-insensitive. For example "kb", "MiB"...
120
+     * @throws ConvertHelper_Exception
121
+     * @return ConvertHelper_StorageSizeEnum_Size
122
+     * 
123
+     * @see ConvertHelper_StorageSizeEnum::ERROR_UNKNOWN_UNIT_NAME
124
+     */
125 125
     public static function getSizeByName(string $name) : ConvertHelper_StorageSizeEnum_Size
126 126
     {
127 127
         self::init();
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
         );
144 144
     }
145 145
     
146
-   /**
147
-    * Retrieves a list of all size names, e.g. "mb", "kib" (lowercase).
148
-    * @return string[]
149
-    */
146
+    /**
147
+     * Retrieves a list of all size names, e.g. "mb", "kib" (lowercase).
148
+     * @return string[]
149
+     */
150 150
     public static function getSizeNames() : array
151 151
     {
152 152
         self::init();
@@ -154,16 +154,16 @@  discard block
 block discarded – undo
154 154
         return array_keys(self::$sizes);
155 155
     }
156 156
    
157
-   /**
158
-    * Retrieves all available storage sizes for the specified
159
-    * base value.
160
-    * 
161
-    * @param int $base
162
-    * @return ConvertHelper_StorageSizeEnum_Size[]
163
-    * 
164
-    * @see ConvertHelper_StorageSizeEnum::BASE_10
165
-    * @see ConvertHelper_StorageSizeEnum::BASE_2
166
-    */
157
+    /**
158
+     * Retrieves all available storage sizes for the specified
159
+     * base value.
160
+     * 
161
+     * @param int $base
162
+     * @return ConvertHelper_StorageSizeEnum_Size[]
163
+     * 
164
+     * @see ConvertHelper_StorageSizeEnum::BASE_10
165
+     * @see ConvertHelper_StorageSizeEnum::BASE_2
166
+     */
167 167
     public static function getSizesByBase(int $base) : array
168 168
     {
169 169
         self::init();
Please login to merge, or discard this patch.
src/ConvertHelper/ControlCharacters.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 {
23 23
     public const ERROR_MALFORMATTED_STRING = 53801;
24 24
     
25
-   /**
26
-    * @var string[]
27
-    */
25
+    /**
26
+     * @var string[]
27
+     */
28 28
     protected static $controlChars =  array(
29 29
         '0000-0008', // control chars
30 30
         '000E-000F', // control chars
@@ -32,19 +32,19 @@  discard block
 block discarded – undo
32 32
         '2000-200F', // non-breaking space and co
33 33
     );
34 34
     
35
-   /**
36
-    * @var string|NULL
37
-    */
35
+    /**
36
+     * @var string|NULL
37
+     */
38 38
     protected static $controlCharsRegex;
39 39
 
40
-   /**
41
-    * @var string[]
42
-    */
40
+    /**
41
+     * @var string[]
42
+     */
43 43
     protected static $hexAlphabet = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
44 44
     
45
-   /**
46
-    * @var string[]|NULL
47
-    */
45
+    /**
46
+     * @var string[]|NULL
47
+     */
48 48
     protected static $charsAsHex;
49 49
     
50 50
     public function __construct()
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
         }
68 68
     }
69 69
     
70
-   /**
71
-    * Retrieves the HEX character codes for all control
72
-    * characters that the {@link stripControlCharacters()}
73
-    * method will remove.
74
-    *
75
-    * @return string[]
76
-    */
70
+    /**
71
+     * Retrieves the HEX character codes for all control
72
+     * characters that the {@link stripControlCharacters()}
73
+     * method will remove.
74
+     *
75
+     * @return string[]
76
+     */
77 77
     public function getCharsAsHex() : array
78 78
     {
79 79
         if (isset(self::$charsAsHex))
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
         return $stack;
121 121
     }
122 122
     
123
-   /**
124
-    * Retrieves an array of all control characters that
125
-    * the {@link stripControlCharacters()} method will
126
-    * remove, as the actual UTF-8 characters.
127
-    *
128
-    * @return string[]
129
-    */
123
+    /**
124
+     * Retrieves an array of all control characters that
125
+     * the {@link stripControlCharacters()} method will
126
+     * remove, as the actual UTF-8 characters.
127
+     *
128
+     * @return string[]
129
+     */
130 130
     public function getCharsAsUTF8() : array
131 131
     {
132 132
         $chars = $this->getCharsAsHex();
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
         return $result;
140 140
     }
141 141
     
142
-   /**
143
-    * Retrieves all control characters as JSON encoded
144
-    * characters, e.g. "\u200b".
145
-    *
146
-    * @return string[]
147
-    */
142
+    /**
143
+     * Retrieves all control characters as JSON encoded
144
+     * characters, e.g. "\u200b".
145
+     *
146
+     * @return string[]
147
+     */
148 148
     public function getCharsAsJSON() : array
149 149
     {
150 150
         $chars = $this->getCharsAsHex();
@@ -157,17 +157,17 @@  discard block
 block discarded – undo
157 157
         return $result;
158 158
     }
159 159
     
160
-   /**
161
-    * Removes all control characters from the specified string
162
-    * that can cause problems in some cases, like creating
163
-    * valid XML documents. This includes invisible non-breaking
164
-    * spaces.
165
-    *
166
-    * @param string $string
167
-    * @return string
168
-    * @see https://stackoverflow.com/a/8171868/2298192
169
-    * @see https://unicode-table.com/en
170
-    */
160
+    /**
161
+     * Removes all control characters from the specified string
162
+     * that can cause problems in some cases, like creating
163
+     * valid XML documents. This includes invisible non-breaking
164
+     * spaces.
165
+     *
166
+     * @param string $string
167
+     * @return string
168
+     * @see https://stackoverflow.com/a/8171868/2298192
169
+     * @see https://unicode-table.com/en
170
+     */
171 171
     public function stripControlCharacters(string $string) : string
172 172
     {
173 173
         if(empty($string)) 
Please login to merge, or discard this patch.
src/XMLHelper/Converter.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 {
47 47
     public const ERROR_FAILED_CONVERTING_TO_JSON = 37901;
48 48
     
49
-   /**
50
-    * @var SimpleXMLElement
51
-    */
49
+    /**
50
+     * @var SimpleXMLElement
51
+     */
52 52
     protected $xml;
53 53
     
54
-   /**
55
-    * @var string|NULL
56
-    */
54
+    /**
55
+     * @var string|NULL
56
+     */
57 57
     protected $json;
58 58
     
59 59
     protected function __construct(SimpleXMLElement $element)
@@ -86,34 +86,34 @@  discard block
 block discarded – undo
86 86
         return self::fromElement(new SimpleXMLElement($xmlString));
87 87
     }
88 88
     
89
-   /**
90
-    * Factory method: creates a converter from an existing SimpleXMLElement instance.
91
-    * 
92
-    * @param SimpleXMLElement $element
93
-    * @return XMLHelper_Converter
94
-    */
89
+    /**
90
+     * Factory method: creates a converter from an existing SimpleXMLElement instance.
91
+     * 
92
+     * @param SimpleXMLElement $element
93
+     * @return XMLHelper_Converter
94
+     */
95 95
     public static function fromElement(SimpleXMLElement $element) : XMLHelper_Converter
96 96
     {
97 97
         return new XMLHelper_Converter($element);
98 98
     }
99 99
 
100
-   /**
101
-    * Factory method: creates a converter from an existing SimpleXMLElement instance.
102
-    *
103
-    * @param DOMElement $element
104
-    * @return XMLHelper_Converter
105
-    */
100
+    /**
101
+     * Factory method: creates a converter from an existing SimpleXMLElement instance.
102
+     *
103
+     * @param DOMElement $element
104
+     * @return XMLHelper_Converter
105
+     */
106 106
     public static function fromDOMElement(DOMElement $element) : XMLHelper_Converter
107 107
     {
108 108
         return new XMLHelper_Converter(simplexml_import_dom($element));
109 109
     }
110 110
     
111
-   /**
112
-    * Converts the XML to JSON.
113
-    * 
114
-    * @return string
115
-    * @throws XMLHelper_Exception|JsonException
116
-    */
111
+    /**
112
+     * Converts the XML to JSON.
113
+     * 
114
+     * @return string
115
+     * @throws XMLHelper_Exception|JsonException
116
+     */
117 117
     public function toJSON() : string
118 118
     {
119 119
         if (isset($this->json))
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
         }
147 147
     }
148 148
 
149
-   /**
150
-    * Converts the XML to an associative array.
151
-    * @return array
152
-    * @throws XMLHelper_Exception|JsonException
153
-    */
149
+    /**
150
+     * Converts the XML to an associative array.
151
+     * @return array
152
+     * @throws XMLHelper_Exception|JsonException
153
+     */
154 154
     public function toArray() : array 
155 155
     {
156 156
         $json = $this->toJSON();
Please login to merge, or discard this patch.
src/XMLHelper/DOMErrors.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 {
24 24
     public const SERIALIZE_SEPARATOR = '__SERSEP__';
25 25
     
26
-   /**
27
-    * @var XMLHelper_DOMErrors_Error[]
28
-    */
26
+    /**
27
+     * @var XMLHelper_DOMErrors_Error[]
28
+     */
29 29
     private $errors;
30 30
     
31
-   /**
32
-    * @param \LibXMLError[]|XMLHelper_DOMErrors_Error[] $libxmlErrors
33
-    */
31
+    /**
32
+     * @param \LibXMLError[]|XMLHelper_DOMErrors_Error[] $libxmlErrors
33
+     */
34 34
     public function __construct(array $libxmlErrors)
35 35
     {
36 36
         foreach($libxmlErrors as $error)
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
         return $this->errors;
57 57
     }
58 58
     
59
-   /**
60
-    * Retrieves all warnings, if any.
61
-    * 
62
-    * @return XMLHelper_DOMErrors_Error[]
63
-    */
59
+    /**
60
+     * Retrieves all warnings, if any.
61
+     * 
62
+     * @return XMLHelper_DOMErrors_Error[]
63
+     */
64 64
     public function getWarnings()
65 65
     {
66 66
         return $this->getByLevel(LIBXML_ERR_WARNING);
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
     }
108 108
     
109 109
     
110
-   /**
111
-    * Retrieves all errors by the specified libxml error level.
112
-    * 
113
-    * @param int $level
114
-    * @return \AppUtils\XMLHelper_DOMErrors_Error[]
115
-    */
110
+    /**
111
+     * Retrieves all errors by the specified libxml error level.
112
+     * 
113
+     * @param int $level
114
+     * @return \AppUtils\XMLHelper_DOMErrors_Error[]
115
+     */
116 116
     public function getByLevel(int $level)
117 117
     {
118 118
         $result = array();
@@ -128,12 +128,12 @@  discard block
 block discarded – undo
128 128
         return $result;
129 129
     }
130 130
     
131
-   /**
132
-    * Retrieves all errors by the specified libxml error code.
133
-    * 
134
-    * @param int $code
135
-    * @return \AppUtils\XMLHelper_DOMErrors_Error[]
136
-    */
131
+    /**
132
+     * Retrieves all errors by the specified libxml error code.
133
+     * 
134
+     * @param int $code
135
+     * @return \AppUtils\XMLHelper_DOMErrors_Error[]
136
+     */
137 137
     public function getByCode(int $code)
138 138
     {
139 139
         $result = array();
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
         return $result;
150 150
     }
151 151
     
152
-   /**
153
-    * Checks whether there are errors matching the libxml error level.
154
-    * 
155
-    * @param int $level
156
-    * @return bool
157
-    */
152
+    /**
153
+     * Checks whether there are errors matching the libxml error level.
154
+     * 
155
+     * @param int $level
156
+     * @return bool
157
+     */
158 158
     public function hasErrorsByLevel(int $level) : bool
159 159
     {
160 160
         foreach($this->errors as $error)
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
         return false;
169 169
     }
170 170
     
171
-   /**
172
-    * Checks whether there are any errors matching the libxml error code.
173
-    * 
174
-    * @param int $code
175
-    * @return bool
176
-    */
171
+    /**
172
+     * Checks whether there are any errors matching the libxml error code.
173
+     * 
174
+     * @param int $code
175
+     * @return bool
176
+     */
177 177
     public function hasErrorsByCode(int $code) : bool
178 178
     {
179 179
         foreach($this->errors as $error)
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
         return $result;
200 200
     }
201 201
     
202
-   /**
203
-    * Serializes the errors collection, so it can be stored and
204
-    * restored as needed, using the `fromSerialized()` method.
205
-    * 
206
-    * @return string
207
-    * @see XMLHelper_DOMErrors::fromSerialized()
208
-    */
202
+    /**
203
+     * Serializes the errors collection, so it can be stored and
204
+     * restored as needed, using the `fromSerialized()` method.
205
+     * 
206
+     * @return string
207
+     * @see XMLHelper_DOMErrors::fromSerialized()
208
+     */
209 209
     public function serialize() : string
210 210
     {
211 211
         $data = array();
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
         return implode(self::SERIALIZE_SEPARATOR, $data);
219 219
     }
220 220
     
221
-   /**
222
-    * Restores the errors collection from a previously serialized
223
-    * collection, using `serialize()`. 
224
-    * 
225
-    * @param string $serialized
226
-    * @return XMLHelper_DOMErrors
227
-    * @see XMLHelper_DOMErrors::serialize()
228
-    */
221
+    /**
222
+     * Restores the errors collection from a previously serialized
223
+     * collection, using `serialize()`. 
224
+     * 
225
+     * @param string $serialized
226
+     * @return XMLHelper_DOMErrors
227
+     * @see XMLHelper_DOMErrors::serialize()
228
+     */
229 229
     public static function fromSerialized(string $serialized) : XMLHelper_DOMErrors
230 230
     {
231 231
         $parts = explode(self::SERIALIZE_SEPARATOR, $serialized);
Please login to merge, or discard this patch.