@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | * @param mixed $value |
15 | 15 | * @return \AppUtils\NumberInfo |
16 | 16 | */ |
17 | -function parseNumber($value, $forceNew=false) |
|
17 | +function parseNumber($value, $forceNew = false) |
|
18 | 18 | { |
19 | - if($value instanceof NumberInfo && $forceNew !== true) { |
|
19 | + if ($value instanceof NumberInfo && $forceNew !== true) { |
|
20 | 20 | return $value; |
21 | 21 | } |
22 | 22 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $args = func_get_args(); |
98 | 98 | |
99 | 99 | // is the localization package installed? |
100 | - if(class_exists('\AppLocalize\Localization')) |
|
100 | + if (class_exists('\AppLocalize\Localization')) |
|
101 | 101 | { |
102 | 102 | return call_user_func_array('\AppLocalize\t', $args); |
103 | 103 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | function requireCURL() : void |
117 | 117 | { |
118 | - if(function_exists('curl_init')) { |
|
118 | + if (function_exists('curl_init')) { |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @param bool $initial The initial boolean value to use. |
133 | 133 | * @return Value_Bool |
134 | 134 | */ |
135 | -function valBool(bool $initial=false) : Value_Bool |
|
135 | +function valBool(bool $initial = false) : Value_Bool |
|
136 | 136 | { |
137 | 137 | return new Value_Bool($initial); |
138 | 138 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * @param bool $initial |
146 | 146 | * @return Value_Bool_True |
147 | 147 | */ |
148 | -function valBoolTrue(bool $initial=false) : Value_Bool_True |
|
148 | +function valBoolTrue(bool $initial = false) : Value_Bool_True |
|
149 | 149 | { |
150 | 150 | return new Value_Bool_True($initial); |
151 | 151 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @param bool $initial |
159 | 159 | * @return Value_Bool_False |
160 | 160 | */ |
161 | -function valBoolFalse(bool $initial=true) : Value_Bool_False |
|
161 | +function valBoolFalse(bool $initial = true) : Value_Bool_False |
|
162 | 162 | { |
163 | 163 | return new Value_Bool_False($initial); |
164 | 164 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | function init() |
172 | 172 | { |
173 | - if(!class_exists('\AppLocalize\Localization')) { |
|
173 | + if (!class_exists('\AppLocalize\Localization')) { |
|
174 | 174 | return; |
175 | 175 | } |
176 | 176 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | { |
22 | 22 | protected $value = false; |
23 | 23 | |
24 | - public function __construct(bool $value=false) |
|
24 | + public function __construct(bool $value = false) |
|
25 | 25 | { |
26 | 26 | $this->value = $value; |
27 | 27 | } |
@@ -22,14 +22,14 @@ |
||
22 | 22 | */ |
23 | 23 | class Value_Bool_False extends Value_Bool |
24 | 24 | { |
25 | - public function __construct(bool $value=true) |
|
25 | + public function __construct(bool $value = true) |
|
26 | 26 | { |
27 | 27 | parent::__construct($value); |
28 | 28 | } |
29 | 29 | |
30 | 30 | public function set(bool $value) : Value_Bool |
31 | 31 | { |
32 | - if($value === false) |
|
32 | + if ($value === false) |
|
33 | 33 | { |
34 | 34 | parent::set($value); |
35 | 35 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | { |
25 | 25 | public function set(bool $value) : Value_Bool |
26 | 26 | { |
27 | - if($value === true) |
|
27 | + if ($value === true) |
|
28 | 28 | { |
29 | 29 | parent::set($value); |
30 | 30 | } |
@@ -37,25 +37,25 @@ discard block |
||
37 | 37 | |
38 | 38 | const ERROR_INVALID_SERIALIZED_DATA = 56301; |
39 | 39 | |
40 | - /** |
|
41 | - * @var string |
|
42 | - */ |
|
40 | + /** |
|
41 | + * @var string |
|
42 | + */ |
|
43 | 43 | protected $string; |
44 | 44 | |
45 | - /** |
|
46 | - * @var mixed |
|
47 | - */ |
|
45 | + /** |
|
46 | + * @var mixed |
|
47 | + */ |
|
48 | 48 | protected $value; |
49 | 49 | |
50 | - /** |
|
51 | - * @var string |
|
52 | - */ |
|
50 | + /** |
|
51 | + * @var string |
|
52 | + */ |
|
53 | 53 | protected $type; |
54 | 54 | |
55 | - /** |
|
56 | - * @param mixed $value |
|
57 | - * @param array|null $serialized |
|
58 | - */ |
|
55 | + /** |
|
56 | + * @param mixed $value |
|
57 | + * @param array|null $serialized |
|
58 | + */ |
|
59 | 59 | public function __construct($value, $serialized=null) |
60 | 60 | { |
61 | 61 | if(is_array($serialized)) |
@@ -68,40 +68,40 @@ discard block |
||
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | - /** |
|
72 | - * Creates a new variable info instance from a PHP variable |
|
73 | - * of any type. |
|
74 | - * |
|
75 | - * @param mixed $variable |
|
76 | - * @return VariableInfo |
|
77 | - */ |
|
71 | + /** |
|
72 | + * Creates a new variable info instance from a PHP variable |
|
73 | + * of any type. |
|
74 | + * |
|
75 | + * @param mixed $variable |
|
76 | + * @return VariableInfo |
|
77 | + */ |
|
78 | 78 | public static function fromVariable($variable) : VariableInfo |
79 | 79 | { |
80 | 80 | return new VariableInfo($variable); |
81 | 81 | } |
82 | 82 | |
83 | - /** |
|
84 | - * Restores a variable info instance using a previously serialized |
|
85 | - * array using the serialize() method. |
|
86 | - * |
|
87 | - * @param array $serialized |
|
88 | - * @return VariableInfo |
|
89 | - * @see VariableInfo::serialize() |
|
90 | - */ |
|
83 | + /** |
|
84 | + * Restores a variable info instance using a previously serialized |
|
85 | + * array using the serialize() method. |
|
86 | + * |
|
87 | + * @param array $serialized |
|
88 | + * @return VariableInfo |
|
89 | + * @see VariableInfo::serialize() |
|
90 | + */ |
|
91 | 91 | public static function fromSerialized(array $serialized) : VariableInfo |
92 | 92 | { |
93 | 93 | return new VariableInfo(null, $serialized); |
94 | 94 | } |
95 | 95 | |
96 | - /** |
|
97 | - * Parses a previously serialized data set to restore the |
|
98 | - * variable information from it. |
|
99 | - * |
|
100 | - * @param array $serialized |
|
101 | - * @throws BaseException |
|
102 | - * |
|
103 | - * @see VariableInfo::ERROR_INVALID_SERIALIZED_DATA |
|
104 | - */ |
|
96 | + /** |
|
97 | + * Parses a previously serialized data set to restore the |
|
98 | + * variable information from it. |
|
99 | + * |
|
100 | + * @param array $serialized |
|
101 | + * @throws BaseException |
|
102 | + * |
|
103 | + * @see VariableInfo::ERROR_INVALID_SERIALIZED_DATA |
|
104 | + */ |
|
105 | 105 | protected function parseSerialized(array $serialized) : void |
106 | 106 | { |
107 | 107 | if(!isset($serialized['string']) || !isset($serialized['type']) || !isset($serialized['options'])) |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | return $this->value; |
137 | 137 | } |
138 | 138 | |
139 | - /** |
|
140 | - * The variable type - this is the same string that |
|
141 | - * is returned by the PHP function `gettype`. |
|
142 | - * |
|
143 | - * @return string |
|
144 | - */ |
|
139 | + /** |
|
140 | + * The variable type - this is the same string that |
|
141 | + * is returned by the PHP function `gettype`. |
|
142 | + * |
|
143 | + * @return string |
|
144 | + */ |
|
145 | 145 | public function getType() : string |
146 | 146 | { |
147 | 147 | return $this->type; |
@@ -155,13 +155,13 @@ discard block |
||
155 | 155 | ); |
156 | 156 | } |
157 | 157 | |
158 | - /** |
|
159 | - * Whether to prepend the variable type before the value, |
|
160 | - * like the var_dump function. Example: <code>string "Some text"</code>. |
|
161 | - * |
|
162 | - * @param bool $enable |
|
163 | - * @return VariableInfo |
|
164 | - */ |
|
158 | + /** |
|
159 | + * Whether to prepend the variable type before the value, |
|
160 | + * like the var_dump function. Example: <code>string "Some text"</code>. |
|
161 | + * |
|
162 | + * @param bool $enable |
|
163 | + * @return VariableInfo |
|
164 | + */ |
|
165 | 165 | public function enableType(bool $enable=true) : VariableInfo |
166 | 166 | { |
167 | 167 | return $this->setOption('prepend-type', $enable); |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | * @param mixed $value |
57 | 57 | * @param array|null $serialized |
58 | 58 | */ |
59 | - public function __construct($value, $serialized=null) |
|
59 | + public function __construct($value, $serialized = null) |
|
60 | 60 | { |
61 | - if(is_array($serialized)) |
|
61 | + if (is_array($serialized)) |
|
62 | 62 | { |
63 | 63 | $this->parseSerialized($serialized); |
64 | 64 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | protected function parseSerialized(array $serialized) : void |
106 | 106 | { |
107 | - if(!isset($serialized['string']) || !isset($serialized['type']) || !isset($serialized['options'])) |
|
107 | + if (!isset($serialized['string']) || !isset($serialized['type']) || !isset($serialized['options'])) |
|
108 | 108 | { |
109 | 109 | throw new BaseException( |
110 | 110 | 'Invalid variable info serialized data.', |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $this->value = $value; |
125 | 125 | $this->type = strtolower(gettype($value)); |
126 | 126 | |
127 | - if(is_array($value) && is_callable($value)) { |
|
127 | + if (is_array($value) && is_callable($value)) { |
|
128 | 128 | $this->type = self::TYPE_CALLABLE; |
129 | 129 | } |
130 | 130 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @param bool $enable |
163 | 163 | * @return VariableInfo |
164 | 164 | */ |
165 | - public function enableType(bool $enable=true) : VariableInfo |
|
165 | + public function enableType(bool $enable = true) : VariableInfo |
|
166 | 166 | { |
167 | 167 | return $this->setOption('prepend-type', $enable); |
168 | 168 | } |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | { |
172 | 172 | $converted = $this->string; |
173 | 173 | |
174 | - if($this->getOption('prepend-type') === true && !$this->isNull()) |
|
174 | + if ($this->getOption('prepend-type') === true && !$this->isNull()) |
|
175 | 175 | { |
176 | - if($this->isString()) |
|
176 | + if ($this->isString()) |
|
177 | 177 | { |
178 | 178 | $converted = '"'.$converted.'"'; |
179 | 179 | } |
@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | */ |
23 | 23 | class ConvertHelper_URLFinder |
24 | 24 | { |
25 | - /** |
|
26 | - * @var string |
|
27 | - */ |
|
25 | + /** |
|
26 | + * @var string |
|
27 | + */ |
|
28 | 28 | protected $subject; |
29 | 29 | |
30 | - /** |
|
31 | - * @var boolean |
|
32 | - */ |
|
30 | + /** |
|
31 | + * @var boolean |
|
32 | + */ |
|
33 | 33 | protected $sorting = false; |
34 | 34 | |
35 | 35 | protected $schemes = array( |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | $this->subject = $subject; |
49 | 49 | } |
50 | 50 | |
51 | - /** |
|
52 | - * Whether to enable sorting the URLs alphabetically (disabled by default). |
|
53 | - * |
|
54 | - * @param bool $enabled |
|
55 | - * @return ConvertHelper_URLFinder |
|
56 | - */ |
|
51 | + /** |
|
52 | + * Whether to enable sorting the URLs alphabetically (disabled by default). |
|
53 | + * |
|
54 | + * @param bool $enabled |
|
55 | + * @return ConvertHelper_URLFinder |
|
56 | + */ |
|
57 | 57 | public function enableSorting(bool $enabled=true) : ConvertHelper_URLFinder |
58 | 58 | { |
59 | 59 | $this->sorting = $enabled; |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | return $this; |
62 | 62 | } |
63 | 63 | |
64 | - /** |
|
65 | - * Prepares the subject string by adding a newline before all URL schemes, |
|
66 | - * to make it possible to parse even lists of links separated by commas or |
|
67 | - * the like (http://domain.com,http://domain2.com). |
|
68 | - */ |
|
64 | + /** |
|
65 | + * Prepares the subject string by adding a newline before all URL schemes, |
|
66 | + * to make it possible to parse even lists of links separated by commas or |
|
67 | + * the like (http://domain.com,http://domain2.com). |
|
68 | + */ |
|
69 | 69 | protected function prepareSubject() : void |
70 | 70 | { |
71 | 71 | $replaces = array(); |
@@ -78,13 +78,13 @@ discard block |
||
78 | 78 | $this->subject = str_replace(array_keys($replaces), array_values($replaces), $this->subject); |
79 | 79 | } |
80 | 80 | |
81 | - /** |
|
82 | - * Fetches all URLs that can be found in the subject string. |
|
83 | - * |
|
84 | - * @return string[] |
|
85 | - * |
|
86 | - * @see https://gist.github.com/gruber/249502 |
|
87 | - */ |
|
81 | + /** |
|
82 | + * Fetches all URLs that can be found in the subject string. |
|
83 | + * |
|
84 | + * @return string[] |
|
85 | + * |
|
86 | + * @see https://gist.github.com/gruber/249502 |
|
87 | + */ |
|
88 | 88 | public function getURLs() : array |
89 | 89 | { |
90 | 90 | $this->prepareSubject(); |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | return $result; |
116 | 116 | } |
117 | 117 | |
118 | - /** |
|
119 | - * Retrieves all URLs as URLInfo instances. |
|
120 | - * |
|
121 | - * @return URLInfo[] |
|
122 | - */ |
|
118 | + /** |
|
119 | + * Retrieves all URLs as URLInfo instances. |
|
120 | + * |
|
121 | + * @return URLInfo[] |
|
122 | + */ |
|
123 | 123 | public function getInfos() |
124 | 124 | { |
125 | 125 | $urls = $this->getURLs(); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param bool $enabled |
55 | 55 | * @return ConvertHelper_URLFinder |
56 | 56 | */ |
57 | - public function enableSorting(bool $enabled=true) : ConvertHelper_URLFinder |
|
57 | + public function enableSorting(bool $enabled = true) : ConvertHelper_URLFinder |
|
58 | 58 | { |
59 | 59 | $this->sorting = $enabled; |
60 | 60 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | $replaces = array(); |
72 | 72 | |
73 | - foreach($this->schemes as $scheme) |
|
73 | + foreach ($this->schemes as $scheme) |
|
74 | 74 | { |
75 | 75 | $replaces[$scheme.':'] = PHP_EOL.$scheme.':'; |
76 | 76 | } |
@@ -94,18 +94,18 @@ discard block |
||
94 | 94 | |
95 | 95 | $result = array(); |
96 | 96 | |
97 | - if(is_array($matches)) |
|
97 | + if (is_array($matches)) |
|
98 | 98 | { |
99 | - foreach($matches[0] as $match) |
|
99 | + foreach ($matches[0] as $match) |
|
100 | 100 | { |
101 | - if(strstr($match, '://') && !in_array($match, $result)) |
|
101 | + if (strstr($match, '://') && !in_array($match, $result)) |
|
102 | 102 | { |
103 | 103 | $result[] = $match; |
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - if($this->sorting) |
|
108 | + if ($this->sorting) |
|
109 | 109 | { |
110 | 110 | usort($result, function(string $a, string $b) { |
111 | 111 | return strnatcasecmp($a, $b); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | $result = array(); |
128 | 128 | |
129 | - foreach($urls as $url) |
|
129 | + foreach ($urls as $url) |
|
130 | 130 | { |
131 | 131 | $result[] = parseURL($url); |
132 | 132 | } |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | return str_replace("\t", str_repeat(' ', $tabSize), $string); |
59 | 59 | } |
60 | 60 | |
61 | - /** |
|
62 | - * Converts spaces to tabs in the specified string. |
|
63 | - * |
|
64 | - * @param string $string |
|
65 | - * @param int $tabSize The amount of spaces per tab in the source string. |
|
66 | - * @return string |
|
67 | - */ |
|
61 | + /** |
|
62 | + * Converts spaces to tabs in the specified string. |
|
63 | + * |
|
64 | + * @param string $string |
|
65 | + * @param int $tabSize The amount of spaces per tab in the source string. |
|
66 | + * @return string |
|
67 | + */ |
|
68 | 68 | public static function spaces2tabs(string $string, int $tabSize=4) : string |
69 | 69 | { |
70 | 70 | return str_replace(str_repeat(' ', $tabSize), "\t", $string); |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | return $converter->convert($string); |
78 | 78 | } |
79 | 79 | |
80 | - /** |
|
81 | - * Converts the specified amount of seconds into |
|
82 | - * a human readable string split in months, weeks, |
|
83 | - * days, hours, minutes and seconds. |
|
84 | - * |
|
85 | - * @param float $seconds |
|
86 | - * @return string |
|
87 | - */ |
|
80 | + /** |
|
81 | + * Converts the specified amount of seconds into |
|
82 | + * a human readable string split in months, weeks, |
|
83 | + * days, hours, minutes and seconds. |
|
84 | + * |
|
85 | + * @param float $seconds |
|
86 | + * @return string |
|
87 | + */ |
|
88 | 88 | public static function time2string($seconds) |
89 | 89 | { |
90 | 90 | static $units = null; |
@@ -156,41 +156,41 @@ discard block |
||
156 | 156 | return implode(', ', $tokens) . ' ' . t('and') . ' ' . $last; |
157 | 157 | } |
158 | 158 | |
159 | - /** |
|
160 | - * Converts a timestamp into an easily understandable |
|
161 | - * format, e.g. "2 hours", "1 day", "3 months" |
|
162 | - * |
|
163 | - * If you set the date to parameter, the difference |
|
164 | - * will be calculated between the two dates and not |
|
165 | - * the current time. |
|
166 | - * |
|
167 | - * @param integer|\DateTime $datefrom |
|
168 | - * @param integer|\DateTime $dateto |
|
169 | - * @return string |
|
170 | - */ |
|
159 | + /** |
|
160 | + * Converts a timestamp into an easily understandable |
|
161 | + * format, e.g. "2 hours", "1 day", "3 months" |
|
162 | + * |
|
163 | + * If you set the date to parameter, the difference |
|
164 | + * will be calculated between the two dates and not |
|
165 | + * the current time. |
|
166 | + * |
|
167 | + * @param integer|\DateTime $datefrom |
|
168 | + * @param integer|\DateTime $dateto |
|
169 | + * @return string |
|
170 | + */ |
|
171 | 171 | public static function duration2string($datefrom, $dateto = -1) : string |
172 | 172 | { |
173 | - $converter = new ConvertHelper_DurationConverter(); |
|
173 | + $converter = new ConvertHelper_DurationConverter(); |
|
174 | 174 | |
175 | - if($datefrom instanceof \DateTime) |
|
176 | - { |
|
177 | - $converter->setDateFrom($datefrom); |
|
178 | - } |
|
179 | - else |
|
180 | - { |
|
181 | - $converter->setDateFrom(self::timestamp2date($datefrom)); |
|
182 | - } |
|
175 | + if($datefrom instanceof \DateTime) |
|
176 | + { |
|
177 | + $converter->setDateFrom($datefrom); |
|
178 | + } |
|
179 | + else |
|
180 | + { |
|
181 | + $converter->setDateFrom(self::timestamp2date($datefrom)); |
|
182 | + } |
|
183 | 183 | |
184 | - if($dateto instanceof \DateTime) |
|
185 | - { |
|
186 | - $converter->setDateTo($dateto); |
|
187 | - } |
|
188 | - else if($dateto > 0) |
|
189 | - { |
|
190 | - $converter->setDateTo(self::timestamp2date($dateto)); |
|
191 | - } |
|
184 | + if($dateto instanceof \DateTime) |
|
185 | + { |
|
186 | + $converter->setDateTo($dateto); |
|
187 | + } |
|
188 | + else if($dateto > 0) |
|
189 | + { |
|
190 | + $converter->setDateTo(self::timestamp2date($dateto)); |
|
191 | + } |
|
192 | 192 | |
193 | - return $converter->convert(); |
|
193 | + return $converter->convert(); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -229,44 +229,44 @@ discard block |
||
229 | 229 | return $geshi->parse_code(); |
230 | 230 | } |
231 | 231 | |
232 | - /** |
|
233 | - * Converts a number of bytes to a human readable form, |
|
234 | - * e.g. xx Kb / xx Mb / xx Gb |
|
235 | - * |
|
236 | - * @param int $bytes The amount of bytes to convert. |
|
237 | - * @param int $precision The amount of decimals |
|
238 | - * @param int $base The base to calculate with: Base 10 is default (=1000 Bytes in a KB), Base 2 is mainly used for Windows memory (=1024 Bytes in a KB). |
|
239 | - * @return string |
|
240 | - * |
|
241 | - * @see https://en.m.wikipedia.org/wiki/Megabyte#Definitions |
|
242 | - */ |
|
232 | + /** |
|
233 | + * Converts a number of bytes to a human readable form, |
|
234 | + * e.g. xx Kb / xx Mb / xx Gb |
|
235 | + * |
|
236 | + * @param int $bytes The amount of bytes to convert. |
|
237 | + * @param int $precision The amount of decimals |
|
238 | + * @param int $base The base to calculate with: Base 10 is default (=1000 Bytes in a KB), Base 2 is mainly used for Windows memory (=1024 Bytes in a KB). |
|
239 | + * @return string |
|
240 | + * |
|
241 | + * @see https://en.m.wikipedia.org/wiki/Megabyte#Definitions |
|
242 | + */ |
|
243 | 243 | public static function bytes2readable(int $bytes, int $precision = 1, int $base = ConvertHelper_StorageSizeEnum::BASE_10) : string |
244 | 244 | { |
245 | 245 | return self::parseBytes($bytes)->toString($precision, $base); |
246 | 246 | } |
247 | 247 | |
248 | - /** |
|
249 | - * Parses a number of bytes, and creates a converter instance which |
|
250 | - * allows doing common operations with it. |
|
251 | - * |
|
252 | - * @param int $bytes |
|
253 | - * @return ConvertHelper_ByteConverter |
|
254 | - */ |
|
248 | + /** |
|
249 | + * Parses a number of bytes, and creates a converter instance which |
|
250 | + * allows doing common operations with it. |
|
251 | + * |
|
252 | + * @param int $bytes |
|
253 | + * @return ConvertHelper_ByteConverter |
|
254 | + */ |
|
255 | 255 | public static function parseBytes(int $bytes) : ConvertHelper_ByteConverter |
256 | 256 | { |
257 | 257 | return new ConvertHelper_ByteConverter($bytes); |
258 | 258 | } |
259 | 259 | |
260 | - /** |
|
261 | - * Cuts a text to the specified length if it is longer than the |
|
262 | - * target length. Appends a text to signify it has been cut at |
|
263 | - * the end of the string. |
|
264 | - * |
|
265 | - * @param string $text |
|
266 | - * @param int $targetLength |
|
267 | - * @param string $append |
|
268 | - * @return string |
|
269 | - */ |
|
260 | + /** |
|
261 | + * Cuts a text to the specified length if it is longer than the |
|
262 | + * target length. Appends a text to signify it has been cut at |
|
263 | + * the end of the string. |
|
264 | + * |
|
265 | + * @param string $text |
|
266 | + * @param int $targetLength |
|
267 | + * @param string $append |
|
268 | + * @return string |
|
269 | + */ |
|
270 | 270 | public static function text_cut(string $text, int $targetLength, string $append = '...') : string |
271 | 271 | { |
272 | 272 | $length = mb_strlen($text); |
@@ -290,14 +290,14 @@ discard block |
||
290 | 290 | return $info->toString(); |
291 | 291 | } |
292 | 292 | |
293 | - /** |
|
294 | - * Pretty print_r. |
|
295 | - * |
|
296 | - * @param mixed $var The variable to dump. |
|
297 | - * @param bool $return Whether to return the dumped code. |
|
298 | - * @param bool $html Whether to style the dump as HTML. |
|
299 | - * @return string |
|
300 | - */ |
|
293 | + /** |
|
294 | + * Pretty print_r. |
|
295 | + * |
|
296 | + * @param mixed $var The variable to dump. |
|
297 | + * @param bool $return Whether to return the dumped code. |
|
298 | + * @param bool $html Whether to style the dump as HTML. |
|
299 | + * @return string |
|
300 | + */ |
|
301 | 301 | public static function print_r($var, bool $return=false, bool $html=true) : string |
302 | 302 | { |
303 | 303 | $result = parseVariable($var)->enableType()->toString(); |
@@ -327,15 +327,15 @@ discard block |
||
327 | 327 | 'no' => false |
328 | 328 | ); |
329 | 329 | |
330 | - /** |
|
331 | - * Converts a string, number or boolean value to a boolean value. |
|
332 | - * |
|
333 | - * @param mixed $string |
|
334 | - * @throws ConvertHelper_Exception |
|
335 | - * @return bool |
|
336 | - * |
|
337 | - * @see ConvertHelper::ERROR_INVALID_BOOLEAN_STRING |
|
338 | - */ |
|
330 | + /** |
|
331 | + * Converts a string, number or boolean value to a boolean value. |
|
332 | + * |
|
333 | + * @param mixed $string |
|
334 | + * @throws ConvertHelper_Exception |
|
335 | + * @return bool |
|
336 | + * |
|
337 | + * @see ConvertHelper::ERROR_INVALID_BOOLEAN_STRING |
|
338 | + */ |
|
339 | 339 | public static function string2bool($string) : bool |
340 | 340 | { |
341 | 341 | if($string === '' || $string === null || !is_scalar($string)) |
@@ -363,27 +363,27 @@ discard block |
||
363 | 363 | ); |
364 | 364 | } |
365 | 365 | |
366 | - /** |
|
367 | - * Whether the specified string is a boolean string or boolean value. |
|
368 | - * Alias for {@link ConvertHelper::isBoolean()}. |
|
369 | - * |
|
370 | - * @param mixed $string |
|
371 | - * @return bool |
|
372 | - * @deprecated |
|
373 | - * @see ConvertHelper::isBoolean() |
|
374 | - */ |
|
366 | + /** |
|
367 | + * Whether the specified string is a boolean string or boolean value. |
|
368 | + * Alias for {@link ConvertHelper::isBoolean()}. |
|
369 | + * |
|
370 | + * @param mixed $string |
|
371 | + * @return bool |
|
372 | + * @deprecated |
|
373 | + * @see ConvertHelper::isBoolean() |
|
374 | + */ |
|
375 | 375 | public static function isBooleanString($string) : bool |
376 | 376 | { |
377 | 377 | return self::isBoolean($string); |
378 | 378 | } |
379 | 379 | |
380 | - /** |
|
381 | - * Alias for the {@\AppUtils\XMLHelper::string2xml()} method. |
|
382 | - * |
|
383 | - * @param string $text |
|
384 | - * @return string |
|
385 | - * @deprecated |
|
386 | - */ |
|
380 | + /** |
|
381 | + * Alias for the {@\AppUtils\XMLHelper::string2xml()} method. |
|
382 | + * |
|
383 | + * @param string $text |
|
384 | + * @return string |
|
385 | + * @deprecated |
|
386 | + */ |
|
387 | 387 | public static function text_makeXMLCompliant($text) |
388 | 388 | { |
389 | 389 | return XMLHelper::string2xml($text); |
@@ -485,80 +485,80 @@ discard block |
||
485 | 485 | return $translit->convert($string); |
486 | 486 | } |
487 | 487 | |
488 | - /** |
|
489 | - * Retrieves the HEX character codes for all control |
|
490 | - * characters that the {@link stripControlCharacters()} |
|
491 | - * method will remove. |
|
492 | - * |
|
493 | - * @return string[] |
|
494 | - */ |
|
488 | + /** |
|
489 | + * Retrieves the HEX character codes for all control |
|
490 | + * characters that the {@link stripControlCharacters()} |
|
491 | + * method will remove. |
|
492 | + * |
|
493 | + * @return string[] |
|
494 | + */ |
|
495 | 495 | public static function getControlCharactersAsHex() |
496 | 496 | { |
497 | 497 | return self::createControlCharacters()->getCharsAsHex(); |
498 | 498 | } |
499 | 499 | |
500 | - /** |
|
501 | - * Retrieves an array of all control characters that |
|
502 | - * the {@link stripControlCharacters()} method will |
|
503 | - * remove, as the actual UTF-8 characters. |
|
504 | - * |
|
505 | - * @return string[] |
|
506 | - */ |
|
500 | + /** |
|
501 | + * Retrieves an array of all control characters that |
|
502 | + * the {@link stripControlCharacters()} method will |
|
503 | + * remove, as the actual UTF-8 characters. |
|
504 | + * |
|
505 | + * @return string[] |
|
506 | + */ |
|
507 | 507 | public static function getControlCharactersAsUTF8() |
508 | 508 | { |
509 | 509 | return self::createControlCharacters()->getCharsAsUTF8(); |
510 | 510 | } |
511 | 511 | |
512 | - /** |
|
513 | - * Retrieves all control characters as JSON encoded |
|
514 | - * characters, e.g. "\u200b". |
|
515 | - * |
|
516 | - * @return string[] |
|
517 | - */ |
|
512 | + /** |
|
513 | + * Retrieves all control characters as JSON encoded |
|
514 | + * characters, e.g. "\u200b". |
|
515 | + * |
|
516 | + * @return string[] |
|
517 | + */ |
|
518 | 518 | public static function getControlCharactersAsJSON() |
519 | 519 | { |
520 | 520 | return self::createControlCharacters()->getCharsAsJSON(); |
521 | 521 | } |
522 | 522 | |
523 | - /** |
|
524 | - * Removes all control characters from the specified string |
|
525 | - * that can cause problems in some cases, like creating |
|
526 | - * valid XML documents. This includes invisible non-breaking |
|
527 | - * spaces. |
|
528 | - * |
|
529 | - * @param string $string |
|
530 | - * @return string |
|
531 | - */ |
|
523 | + /** |
|
524 | + * Removes all control characters from the specified string |
|
525 | + * that can cause problems in some cases, like creating |
|
526 | + * valid XML documents. This includes invisible non-breaking |
|
527 | + * spaces. |
|
528 | + * |
|
529 | + * @param string $string |
|
530 | + * @return string |
|
531 | + */ |
|
532 | 532 | public static function stripControlCharacters(string $string) : string |
533 | 533 | { |
534 | 534 | return self::createControlCharacters()->stripControlCharacters($string); |
535 | 535 | } |
536 | 536 | |
537 | - /** |
|
538 | - * Creates the control characters class, used to |
|
539 | - * work with control characters in strings. |
|
540 | - * |
|
541 | - * @return ConvertHelper_ControlCharacters |
|
542 | - */ |
|
537 | + /** |
|
538 | + * Creates the control characters class, used to |
|
539 | + * work with control characters in strings. |
|
540 | + * |
|
541 | + * @return ConvertHelper_ControlCharacters |
|
542 | + */ |
|
543 | 543 | public static function createControlCharacters() : ConvertHelper_ControlCharacters |
544 | 544 | { |
545 | 545 | return new ConvertHelper_ControlCharacters(); |
546 | 546 | } |
547 | 547 | |
548 | - /** |
|
549 | - * Converts a unicode character to the PHPO notation. |
|
550 | - * |
|
551 | - * Example: |
|
552 | - * |
|
553 | - * <pre>unicodeChar2php('"\u0000"')</pre> |
|
554 | - * |
|
555 | - * Returns |
|
556 | - * |
|
557 | - * <pre>\x0</pre> |
|
558 | - * |
|
559 | - * @param string $unicodeChar |
|
560 | - * @return string |
|
561 | - */ |
|
548 | + /** |
|
549 | + * Converts a unicode character to the PHPO notation. |
|
550 | + * |
|
551 | + * Example: |
|
552 | + * |
|
553 | + * <pre>unicodeChar2php('"\u0000"')</pre> |
|
554 | + * |
|
555 | + * Returns |
|
556 | + * |
|
557 | + * <pre>\x0</pre> |
|
558 | + * |
|
559 | + * @param string $unicodeChar |
|
560 | + * @return string |
|
561 | + */ |
|
562 | 562 | public static function unicodeChar2php(string $unicodeChar) : string |
563 | 563 | { |
564 | 564 | $unicodeChar = json_decode($unicodeChar); |
@@ -684,25 +684,25 @@ discard block |
||
684 | 684 | return 'false'; |
685 | 685 | } |
686 | 686 | |
687 | - /** |
|
688 | - * Converts an associative array with attribute name > value pairs |
|
689 | - * to an attribute string that can be used in an HTML tag. Empty |
|
690 | - * attribute values are ignored. |
|
691 | - * |
|
692 | - * Example: |
|
693 | - * |
|
694 | - * array2attributeString(array( |
|
695 | - * 'id' => 45, |
|
696 | - * 'href' => 'http://www.mistralys.com' |
|
697 | - * )); |
|
698 | - * |
|
699 | - * Result: |
|
700 | - * |
|
701 | - * id="45" href="http://www.mistralys.com" |
|
702 | - * |
|
703 | - * @param array $array |
|
704 | - * @return string |
|
705 | - */ |
|
687 | + /** |
|
688 | + * Converts an associative array with attribute name > value pairs |
|
689 | + * to an attribute string that can be used in an HTML tag. Empty |
|
690 | + * attribute values are ignored. |
|
691 | + * |
|
692 | + * Example: |
|
693 | + * |
|
694 | + * array2attributeString(array( |
|
695 | + * 'id' => 45, |
|
696 | + * 'href' => 'http://www.mistralys.com' |
|
697 | + * )); |
|
698 | + * |
|
699 | + * Result: |
|
700 | + * |
|
701 | + * id="45" href="http://www.mistralys.com" |
|
702 | + * |
|
703 | + * @param array $array |
|
704 | + * @return string |
|
705 | + */ |
|
706 | 706 | public static function array2attributeString($array) |
707 | 707 | { |
708 | 708 | $tokens = array(); |
@@ -721,14 +721,14 @@ discard block |
||
721 | 721 | return ' '.implode(' ', $tokens); |
722 | 722 | } |
723 | 723 | |
724 | - /** |
|
725 | - * Converts a string so it can safely be used in a javascript |
|
726 | - * statement in an HTML tag: uses single quotes around the string |
|
727 | - * and encodes all special characters as needed. |
|
728 | - * |
|
729 | - * @param string $string |
|
730 | - * @return string |
|
731 | - */ |
|
724 | + /** |
|
725 | + * Converts a string so it can safely be used in a javascript |
|
726 | + * statement in an HTML tag: uses single quotes around the string |
|
727 | + * and encodes all special characters as needed. |
|
728 | + * |
|
729 | + * @param string $string |
|
730 | + * @return string |
|
731 | + */ |
|
732 | 732 | public static function string2attributeJS($string, $quoted=true) |
733 | 733 | { |
734 | 734 | $converted = addslashes(htmlspecialchars(strip_tags($string), ENT_QUOTES, 'UTF-8')); |
@@ -739,15 +739,15 @@ discard block |
||
739 | 739 | return $converted; |
740 | 740 | } |
741 | 741 | |
742 | - /** |
|
743 | - * Checks if the specified string is a boolean value, which |
|
744 | - * includes string representations of boolean values, like |
|
745 | - * <code>yes</code> or <code>no</code>, and <code>true</code> |
|
746 | - * or <code>false</code>. |
|
747 | - * |
|
748 | - * @param mixed $value |
|
749 | - * @return boolean |
|
750 | - */ |
|
742 | + /** |
|
743 | + * Checks if the specified string is a boolean value, which |
|
744 | + * includes string representations of boolean values, like |
|
745 | + * <code>yes</code> or <code>no</code>, and <code>true</code> |
|
746 | + * or <code>false</code>. |
|
747 | + * |
|
748 | + * @param mixed $value |
|
749 | + * @return boolean |
|
750 | + */ |
|
751 | 751 | public static function isBoolean($value) : bool |
752 | 752 | { |
753 | 753 | if(is_bool($value)) { |
@@ -761,12 +761,12 @@ discard block |
||
761 | 761 | return array_key_exists($value, self::$booleanStrings); |
762 | 762 | } |
763 | 763 | |
764 | - /** |
|
765 | - * Converts an associative array to an HTML style attribute value string. |
|
766 | - * |
|
767 | - * @param array $subject |
|
768 | - * @return string |
|
769 | - */ |
|
764 | + /** |
|
765 | + * Converts an associative array to an HTML style attribute value string. |
|
766 | + * |
|
767 | + * @param array $subject |
|
768 | + * @return string |
|
769 | + */ |
|
770 | 770 | public static function array2styleString(array $subject) : string |
771 | 771 | { |
772 | 772 | $tokens = array(); |
@@ -777,23 +777,23 @@ discard block |
||
777 | 777 | return implode(';', $tokens); |
778 | 778 | } |
779 | 779 | |
780 | - /** |
|
781 | - * Converts a DateTime object to a timestamp, which |
|
782 | - * is PHP 5.2 compatible. |
|
783 | - * |
|
784 | - * @param \DateTime $date |
|
785 | - * @return integer |
|
786 | - */ |
|
780 | + /** |
|
781 | + * Converts a DateTime object to a timestamp, which |
|
782 | + * is PHP 5.2 compatible. |
|
783 | + * |
|
784 | + * @param \DateTime $date |
|
785 | + * @return integer |
|
786 | + */ |
|
787 | 787 | public static function date2timestamp(\DateTime $date) : int |
788 | 788 | { |
789 | 789 | return (int)$date->format('U'); |
790 | 790 | } |
791 | 791 | |
792 | - /** |
|
793 | - * Converts a timestamp into a DateTime instance. |
|
794 | - * @param int $timestamp |
|
795 | - * @return \DateTime |
|
796 | - */ |
|
792 | + /** |
|
793 | + * Converts a timestamp into a DateTime instance. |
|
794 | + * @param int $timestamp |
|
795 | + * @return \DateTime |
|
796 | + */ |
|
797 | 797 | public static function timestamp2date(int $timestamp) : \DateTime |
798 | 798 | { |
799 | 799 | $date = new \DateTime(); |
@@ -801,50 +801,50 @@ discard block |
||
801 | 801 | return $date; |
802 | 802 | } |
803 | 803 | |
804 | - /** |
|
805 | - * Strips an absolute path to a file within the application |
|
806 | - * to make the path relative to the application root path. |
|
807 | - * |
|
808 | - * @param string $path |
|
809 | - * @return string |
|
810 | - * |
|
811 | - * @see FileHelper::relativizePath() |
|
812 | - * @see FileHelper::relativizePathByDepth() |
|
813 | - */ |
|
804 | + /** |
|
805 | + * Strips an absolute path to a file within the application |
|
806 | + * to make the path relative to the application root path. |
|
807 | + * |
|
808 | + * @param string $path |
|
809 | + * @return string |
|
810 | + * |
|
811 | + * @see FileHelper::relativizePath() |
|
812 | + * @see FileHelper::relativizePathByDepth() |
|
813 | + */ |
|
814 | 814 | public static function fileRelativize(string $path) : string |
815 | 815 | { |
816 | 816 | return FileHelper::relativizePathByDepth($path); |
817 | 817 | } |
818 | 818 | |
819 | 819 | /** |
820 | - * Converts a PHP regex to a javascript RegExp object statement. |
|
821 | - * |
|
822 | - * NOTE: This is an alias for the JSHelper's `convertRegex` method. |
|
823 | - * More details are available on its usage there. |
|
824 | - * |
|
825 | - * @param string $regex A PHP preg regex |
|
826 | - * @param string $statementType The type of statement to return: Defaults to a statement to create a RegExp object. |
|
827 | - * @return array|string Depending on the specified return type. |
|
828 | - * |
|
829 | - * @see JSHelper::buildRegexStatement() |
|
830 | - */ |
|
820 | + * Converts a PHP regex to a javascript RegExp object statement. |
|
821 | + * |
|
822 | + * NOTE: This is an alias for the JSHelper's `convertRegex` method. |
|
823 | + * More details are available on its usage there. |
|
824 | + * |
|
825 | + * @param string $regex A PHP preg regex |
|
826 | + * @param string $statementType The type of statement to return: Defaults to a statement to create a RegExp object. |
|
827 | + * @return array|string Depending on the specified return type. |
|
828 | + * |
|
829 | + * @see JSHelper::buildRegexStatement() |
|
830 | + */ |
|
831 | 831 | public static function regex2js(string $regex, string $statementType=JSHelper::JS_REGEX_OBJECT) |
832 | 832 | { |
833 | 833 | return JSHelper::buildRegexStatement($regex, $statementType); |
834 | 834 | } |
835 | 835 | |
836 | - /** |
|
837 | - * Converts the specified variable to JSON. Works just |
|
838 | - * like the native `json_encode` method, except that it |
|
839 | - * will trigger an exception on failure, which has the |
|
840 | - * json error details included in its developer details. |
|
841 | - * |
|
842 | - * @param mixed $variable |
|
843 | - * @param int $options JSON encode options. |
|
844 | - * @param int $depth |
|
845 | - * @throws ConvertHelper_Exception |
|
846 | - * @return string |
|
847 | - */ |
|
836 | + /** |
|
837 | + * Converts the specified variable to JSON. Works just |
|
838 | + * like the native `json_encode` method, except that it |
|
839 | + * will trigger an exception on failure, which has the |
|
840 | + * json error details included in its developer details. |
|
841 | + * |
|
842 | + * @param mixed $variable |
|
843 | + * @param int $options JSON encode options. |
|
844 | + * @param int $depth |
|
845 | + * @throws ConvertHelper_Exception |
|
846 | + * @return string |
|
847 | + */ |
|
848 | 848 | public static function var2json($variable, int $options=0, int $depth=512) : string |
849 | 849 | { |
850 | 850 | $result = json_encode($variable, $options, $depth); |
@@ -865,12 +865,12 @@ discard block |
||
865 | 865 | ); |
866 | 866 | } |
867 | 867 | |
868 | - /** |
|
869 | - * Strips all known UTF byte order marks from the specified string. |
|
870 | - * |
|
871 | - * @param string $string |
|
872 | - * @return string |
|
873 | - */ |
|
868 | + /** |
|
869 | + * Strips all known UTF byte order marks from the specified string. |
|
870 | + * |
|
871 | + * @param string $string |
|
872 | + * @return string |
|
873 | + */ |
|
874 | 874 | public static function stripUTFBom($string) |
875 | 875 | { |
876 | 876 | $boms = FileHelper::getUTFBOMs(); |
@@ -885,13 +885,13 @@ discard block |
||
885 | 885 | return $string; |
886 | 886 | } |
887 | 887 | |
888 | - /** |
|
889 | - * Converts a string to valid utf8, regardless |
|
890 | - * of the string's encoding(s). |
|
891 | - * |
|
892 | - * @param string $string |
|
893 | - * @return string |
|
894 | - */ |
|
888 | + /** |
|
889 | + * Converts a string to valid utf8, regardless |
|
890 | + * of the string's encoding(s). |
|
891 | + * |
|
892 | + * @param string $string |
|
893 | + * @return string |
|
894 | + */ |
|
895 | 895 | public static function string2utf8($string) |
896 | 896 | { |
897 | 897 | if(!self::isStringASCII($string)) { |
@@ -901,15 +901,15 @@ discard block |
||
901 | 901 | return $string; |
902 | 902 | } |
903 | 903 | |
904 | - /** |
|
905 | - * Checks whether the specified string is an ASCII |
|
906 | - * string, without any special or UTF8 characters. |
|
907 | - * Note: empty strings and NULL are considered ASCII. |
|
908 | - * Any variable types other than strings are not. |
|
909 | - * |
|
910 | - * @param mixed $string |
|
911 | - * @return boolean |
|
912 | - */ |
|
904 | + /** |
|
905 | + * Checks whether the specified string is an ASCII |
|
906 | + * string, without any special or UTF8 characters. |
|
907 | + * Note: empty strings and NULL are considered ASCII. |
|
908 | + * Any variable types other than strings are not. |
|
909 | + * |
|
910 | + * @param mixed $string |
|
911 | + * @return boolean |
|
912 | + */ |
|
913 | 913 | public static function isStringASCII($string) : bool |
914 | 914 | { |
915 | 915 | if($string === '' || $string === NULL) { |
@@ -934,22 +934,22 @@ discard block |
||
934 | 934 | return $url; |
935 | 935 | } |
936 | 936 | |
937 | - /** |
|
938 | - * Calculates a percentage match of the source string with the target string. |
|
939 | - * |
|
940 | - * Options are: |
|
941 | - * |
|
942 | - * - maxLevenshtein, default: 10 |
|
943 | - * Any levenshtein results above this value are ignored. |
|
944 | - * |
|
945 | - * - precision, default: 1 |
|
946 | - * The precision of the percentage float value |
|
947 | - * |
|
948 | - * @param string $source |
|
949 | - * @param string $target |
|
950 | - * @param array $options |
|
951 | - * @return float |
|
952 | - */ |
|
937 | + /** |
|
938 | + * Calculates a percentage match of the source string with the target string. |
|
939 | + * |
|
940 | + * Options are: |
|
941 | + * |
|
942 | + * - maxLevenshtein, default: 10 |
|
943 | + * Any levenshtein results above this value are ignored. |
|
944 | + * |
|
945 | + * - precision, default: 1 |
|
946 | + * The precision of the percentage float value |
|
947 | + * |
|
948 | + * @param string $source |
|
949 | + * @param string $target |
|
950 | + * @param array $options |
|
951 | + * @return float |
|
952 | + */ |
|
953 | 953 | public static function matchString($source, $target, $options=array()) |
954 | 954 | { |
955 | 955 | $defaults = array( |
@@ -973,14 +973,14 @@ discard block |
||
973 | 973 | return round(100 - $percent, $options['precision']); |
974 | 974 | } |
975 | 975 | |
976 | - /** |
|
977 | - * Converts a date interval to a human readable string with |
|
978 | - * all necessary time components, e.g. "1 year, 2 months and 4 days". |
|
979 | - * |
|
980 | - * @param \DateInterval $interval |
|
981 | - * @return string |
|
982 | - * @see ConvertHelper_IntervalConverter |
|
983 | - */ |
|
976 | + /** |
|
977 | + * Converts a date interval to a human readable string with |
|
978 | + * all necessary time components, e.g. "1 year, 2 months and 4 days". |
|
979 | + * |
|
980 | + * @param \DateInterval $interval |
|
981 | + * @return string |
|
982 | + * @see ConvertHelper_IntervalConverter |
|
983 | + */ |
|
984 | 984 | public static function interval2string(\DateInterval $interval) : string |
985 | 985 | { |
986 | 986 | $converter = new ConvertHelper_IntervalConverter(); |
@@ -995,60 +995,60 @@ discard block |
||
995 | 995 | |
996 | 996 | const INTERVAL_SECONDS = 'seconds'; |
997 | 997 | |
998 | - /** |
|
999 | - * Converts an interval to its total amount of days. |
|
1000 | - * @param \DateInterval $interval |
|
1001 | - * @return int |
|
1002 | - */ |
|
998 | + /** |
|
999 | + * Converts an interval to its total amount of days. |
|
1000 | + * @param \DateInterval $interval |
|
1001 | + * @return int |
|
1002 | + */ |
|
1003 | 1003 | public static function interval2days(\DateInterval $interval) : int |
1004 | 1004 | { |
1005 | 1005 | return self::interval2total($interval, self::INTERVAL_DAYS); |
1006 | 1006 | } |
1007 | 1007 | |
1008 | - /** |
|
1009 | - * Converts an interval to its total amount of hours. |
|
1010 | - * @param \DateInterval $interval |
|
1011 | - * @return int |
|
1012 | - */ |
|
1008 | + /** |
|
1009 | + * Converts an interval to its total amount of hours. |
|
1010 | + * @param \DateInterval $interval |
|
1011 | + * @return int |
|
1012 | + */ |
|
1013 | 1013 | public static function interval2hours(\DateInterval $interval) : int |
1014 | 1014 | { |
1015 | 1015 | return self::interval2total($interval, self::INTERVAL_HOURS); |
1016 | 1016 | } |
1017 | 1017 | |
1018 | - /** |
|
1019 | - * Converts an interval to its total amount of minutes. |
|
1020 | - * @param \DateInterval $interval |
|
1021 | - * @return int |
|
1022 | - */ |
|
1018 | + /** |
|
1019 | + * Converts an interval to its total amount of minutes. |
|
1020 | + * @param \DateInterval $interval |
|
1021 | + * @return int |
|
1022 | + */ |
|
1023 | 1023 | public static function interval2minutes(\DateInterval $interval) : int |
1024 | 1024 | { |
1025 | 1025 | return self::interval2total($interval, self::INTERVAL_MINUTES); |
1026 | 1026 | } |
1027 | 1027 | |
1028 | - /** |
|
1029 | - * Converts an interval to its total amount of seconds. |
|
1030 | - * @param \DateInterval $interval |
|
1031 | - * @return int |
|
1032 | - */ |
|
1028 | + /** |
|
1029 | + * Converts an interval to its total amount of seconds. |
|
1030 | + * @param \DateInterval $interval |
|
1031 | + * @return int |
|
1032 | + */ |
|
1033 | 1033 | public static function interval2seconds(\DateInterval $interval) : int |
1034 | 1034 | { |
1035 | 1035 | return self::interval2total($interval, self::INTERVAL_SECONDS); |
1036 | 1036 | } |
1037 | 1037 | |
1038 | - /** |
|
1039 | - * Calculates the total amount of days / hours / minutes or seconds |
|
1040 | - * of a date interval object (depending in the specified units), and |
|
1041 | - * returns the total amount. |
|
1042 | - * |
|
1043 | - * @param \DateInterval $interval |
|
1044 | - * @param string $unit What total value to calculate. |
|
1045 | - * @return integer |
|
1046 | - * |
|
1047 | - * @see ConvertHelper::INTERVAL_SECONDS |
|
1048 | - * @see ConvertHelper::INTERVAL_MINUTES |
|
1049 | - * @see ConvertHelper::INTERVAL_HOURS |
|
1050 | - * @see ConvertHelper::INTERVAL_DAYS |
|
1051 | - */ |
|
1038 | + /** |
|
1039 | + * Calculates the total amount of days / hours / minutes or seconds |
|
1040 | + * of a date interval object (depending in the specified units), and |
|
1041 | + * returns the total amount. |
|
1042 | + * |
|
1043 | + * @param \DateInterval $interval |
|
1044 | + * @param string $unit What total value to calculate. |
|
1045 | + * @return integer |
|
1046 | + * |
|
1047 | + * @see ConvertHelper::INTERVAL_SECONDS |
|
1048 | + * @see ConvertHelper::INTERVAL_MINUTES |
|
1049 | + * @see ConvertHelper::INTERVAL_HOURS |
|
1050 | + * @see ConvertHelper::INTERVAL_DAYS |
|
1051 | + */ |
|
1052 | 1052 | public static function interval2total(\DateInterval $interval, $unit=self::INTERVAL_SECONDS) : int |
1053 | 1053 | { |
1054 | 1054 | $total = (int)$interval->format('%a'); |
@@ -1088,13 +1088,13 @@ discard block |
||
1088 | 1088 | 'Sunday' |
1089 | 1089 | ); |
1090 | 1090 | |
1091 | - /** |
|
1092 | - * Converts a date to the corresponding day name. |
|
1093 | - * |
|
1094 | - * @param \DateTime $date |
|
1095 | - * @param bool $short |
|
1096 | - * @return string|NULL |
|
1097 | - */ |
|
1091 | + /** |
|
1092 | + * Converts a date to the corresponding day name. |
|
1093 | + * |
|
1094 | + * @param \DateTime $date |
|
1095 | + * @param bool $short |
|
1096 | + * @return string|NULL |
|
1097 | + */ |
|
1098 | 1098 | public static function date2dayName(\DateTime $date, bool $short=false) |
1099 | 1099 | { |
1100 | 1100 | $day = $date->format('l'); |
@@ -1109,21 +1109,21 @@ discard block |
||
1109 | 1109 | return null; |
1110 | 1110 | } |
1111 | 1111 | |
1112 | - /** |
|
1113 | - * Retrieves a list of english day names. |
|
1114 | - * @return string[] |
|
1115 | - */ |
|
1112 | + /** |
|
1113 | + * Retrieves a list of english day names. |
|
1114 | + * @return string[] |
|
1115 | + */ |
|
1116 | 1116 | public static function getDayNamesInvariant() |
1117 | 1117 | { |
1118 | 1118 | return self::$daysInvariant; |
1119 | 1119 | } |
1120 | 1120 | |
1121 | - /** |
|
1122 | - * Retrieves the day names list for the current locale. |
|
1123 | - * |
|
1124 | - * @param bool $short |
|
1125 | - * @return array |
|
1126 | - */ |
|
1121 | + /** |
|
1122 | + * Retrieves the day names list for the current locale. |
|
1123 | + * |
|
1124 | + * @param bool $short |
|
1125 | + * @return array |
|
1126 | + */ |
|
1127 | 1127 | public static function getDayNames(bool $short=false) : array |
1128 | 1128 | { |
1129 | 1129 | if($short) { |
@@ -1183,16 +1183,16 @@ discard block |
||
1183 | 1183 | return $last; |
1184 | 1184 | } |
1185 | 1185 | |
1186 | - /** |
|
1187 | - * Splits a string into an array of all characters it is composed of. |
|
1188 | - * Unicode character safe. |
|
1189 | - * |
|
1190 | - * NOTE: Spaces and newlines (both \r and \n) are also considered single |
|
1191 | - * characters. |
|
1192 | - * |
|
1193 | - * @param string $string |
|
1194 | - * @return array |
|
1195 | - */ |
|
1186 | + /** |
|
1187 | + * Splits a string into an array of all characters it is composed of. |
|
1188 | + * Unicode character safe. |
|
1189 | + * |
|
1190 | + * NOTE: Spaces and newlines (both \r and \n) are also considered single |
|
1191 | + * characters. |
|
1192 | + * |
|
1193 | + * @param string $string |
|
1194 | + * @return array |
|
1195 | + */ |
|
1196 | 1196 | public static function string2array(string $string) : array |
1197 | 1197 | { |
1198 | 1198 | $result = preg_split('//u', $string, null, PREG_SPLIT_NO_EMPTY); |
@@ -1203,12 +1203,12 @@ discard block |
||
1203 | 1203 | return array(); |
1204 | 1204 | } |
1205 | 1205 | |
1206 | - /** |
|
1207 | - * Checks whether the specified string contains HTML code. |
|
1208 | - * |
|
1209 | - * @param string $string |
|
1210 | - * @return boolean |
|
1211 | - */ |
|
1206 | + /** |
|
1207 | + * Checks whether the specified string contains HTML code. |
|
1208 | + * |
|
1209 | + * @param string $string |
|
1210 | + * @return boolean |
|
1211 | + */ |
|
1212 | 1212 | public static function isStringHTML(string $string) : bool |
1213 | 1213 | { |
1214 | 1214 | if(preg_match('%<[a-z/][\s\S]*>%siU', $string)) { |
@@ -1223,17 +1223,17 @@ discard block |
||
1223 | 1223 | return false; |
1224 | 1224 | } |
1225 | 1225 | |
1226 | - /** |
|
1227 | - * UTF8-safe wordwrap method: works like the regular wordwrap |
|
1228 | - * PHP function but compatible with UTF8. Otherwise the lengths |
|
1229 | - * are not calculated correctly. |
|
1230 | - * |
|
1231 | - * @param string $str |
|
1232 | - * @param int $width |
|
1233 | - * @param string $break |
|
1234 | - * @param bool $cut |
|
1235 | - * @return string |
|
1236 | - */ |
|
1226 | + /** |
|
1227 | + * UTF8-safe wordwrap method: works like the regular wordwrap |
|
1228 | + * PHP function but compatible with UTF8. Otherwise the lengths |
|
1229 | + * are not calculated correctly. |
|
1230 | + * |
|
1231 | + * @param string $str |
|
1232 | + * @param int $width |
|
1233 | + * @param string $break |
|
1234 | + * @param bool $cut |
|
1235 | + * @return string |
|
1236 | + */ |
|
1237 | 1237 | public static function wordwrap(string $str, int $width = 75, string $break = "\n", bool $cut = false) : string |
1238 | 1238 | { |
1239 | 1239 | $wrapper = new ConvertHelper_WordWrapper(); |
@@ -1245,27 +1245,27 @@ discard block |
||
1245 | 1245 | ->wrapText($str); |
1246 | 1246 | } |
1247 | 1247 | |
1248 | - /** |
|
1249 | - * Calculates the byte length of a string, taking into |
|
1250 | - * account any unicode characters. |
|
1251 | - * |
|
1252 | - * @param string $string |
|
1253 | - * @return int |
|
1254 | - * @see https://stackoverflow.com/a/9718273/2298192 |
|
1255 | - */ |
|
1248 | + /** |
|
1249 | + * Calculates the byte length of a string, taking into |
|
1250 | + * account any unicode characters. |
|
1251 | + * |
|
1252 | + * @param string $string |
|
1253 | + * @return int |
|
1254 | + * @see https://stackoverflow.com/a/9718273/2298192 |
|
1255 | + */ |
|
1256 | 1256 | public static function string2bytes($string) |
1257 | 1257 | { |
1258 | 1258 | return mb_strlen($string, '8bit'); |
1259 | 1259 | } |
1260 | 1260 | |
1261 | - /** |
|
1262 | - * Creates a short, 8-character long hash for the specified string. |
|
1263 | - * |
|
1264 | - * WARNING: Not cryptographically safe. |
|
1265 | - * |
|
1266 | - * @param string $string |
|
1267 | - * @return string |
|
1268 | - */ |
|
1261 | + /** |
|
1262 | + * Creates a short, 8-character long hash for the specified string. |
|
1263 | + * |
|
1264 | + * WARNING: Not cryptographically safe. |
|
1265 | + * |
|
1266 | + * @param string $string |
|
1267 | + * @return string |
|
1268 | + */ |
|
1269 | 1269 | public static function string2shortHash($string) |
1270 | 1270 | { |
1271 | 1271 | return hash('crc32', $string, false); |
@@ -1291,40 +1291,40 @@ discard block |
||
1291 | 1291 | return ConvertHelper_ThrowableInfo::fromThrowable($e); |
1292 | 1292 | } |
1293 | 1293 | |
1294 | - /** |
|
1295 | - * Parses the specified query string like the native |
|
1296 | - * function <code>parse_str</code>, without the key |
|
1297 | - * naming limitations. |
|
1298 | - * |
|
1299 | - * Using parse_str, dots or spaces in key names are |
|
1300 | - * replaced by underscores. This method keeps all names |
|
1301 | - * intact. |
|
1302 | - * |
|
1303 | - * It still uses the parse_str implementation as it |
|
1304 | - * is tested and tried, but fixes the parameter names |
|
1305 | - * after parsing, as needed. |
|
1306 | - * |
|
1307 | - * @param string $queryString |
|
1308 | - * @return array |
|
1309 | - * @see ConvertHelper_QueryParser |
|
1310 | - */ |
|
1294 | + /** |
|
1295 | + * Parses the specified query string like the native |
|
1296 | + * function <code>parse_str</code>, without the key |
|
1297 | + * naming limitations. |
|
1298 | + * |
|
1299 | + * Using parse_str, dots or spaces in key names are |
|
1300 | + * replaced by underscores. This method keeps all names |
|
1301 | + * intact. |
|
1302 | + * |
|
1303 | + * It still uses the parse_str implementation as it |
|
1304 | + * is tested and tried, but fixes the parameter names |
|
1305 | + * after parsing, as needed. |
|
1306 | + * |
|
1307 | + * @param string $queryString |
|
1308 | + * @return array |
|
1309 | + * @see ConvertHelper_QueryParser |
|
1310 | + */ |
|
1311 | 1311 | public static function parseQueryString(string $queryString) : array |
1312 | 1312 | { |
1313 | 1313 | $parser = new ConvertHelper_QueryParser(); |
1314 | 1314 | return $parser->parse($queryString); |
1315 | 1315 | } |
1316 | 1316 | |
1317 | - /** |
|
1318 | - * Searches for needle in the specified string, and returns a list |
|
1319 | - * of all occurrences, including the matched string. The matched |
|
1320 | - * string is useful when doing a case insensitive search, as it |
|
1321 | - * shows the exact matched case of needle. |
|
1322 | - * |
|
1323 | - * @param string $needle |
|
1324 | - * @param string $haystack |
|
1325 | - * @param bool $caseInsensitive |
|
1326 | - * @return ConvertHelper_StringMatch[] |
|
1327 | - */ |
|
1317 | + /** |
|
1318 | + * Searches for needle in the specified string, and returns a list |
|
1319 | + * of all occurrences, including the matched string. The matched |
|
1320 | + * string is useful when doing a case insensitive search, as it |
|
1321 | + * shows the exact matched case of needle. |
|
1322 | + * |
|
1323 | + * @param string $needle |
|
1324 | + * @param string $haystack |
|
1325 | + * @param bool $caseInsensitive |
|
1326 | + * @return ConvertHelper_StringMatch[] |
|
1327 | + */ |
|
1328 | 1328 | public static function findString(string $needle, string $haystack, bool $caseInsensitive=false) |
1329 | 1329 | { |
1330 | 1330 | if($needle === '') { |
@@ -1350,14 +1350,14 @@ discard block |
||
1350 | 1350 | return $positions; |
1351 | 1351 | } |
1352 | 1352 | |
1353 | - /** |
|
1354 | - * Like explode, but trims all entries, and removes |
|
1355 | - * empty entries from the resulting array. |
|
1356 | - * |
|
1357 | - * @param string $delimiter |
|
1358 | - * @param string $string |
|
1359 | - * @return string[] |
|
1360 | - */ |
|
1353 | + /** |
|
1354 | + * Like explode, but trims all entries, and removes |
|
1355 | + * empty entries from the resulting array. |
|
1356 | + * |
|
1357 | + * @param string $delimiter |
|
1358 | + * @param string $string |
|
1359 | + * @return string[] |
|
1360 | + */ |
|
1361 | 1361 | public static function explodeTrim(string $delimiter, string $string) : array |
1362 | 1362 | { |
1363 | 1363 | if(empty($string) || empty($delimiter)) { |
@@ -1379,12 +1379,12 @@ discard block |
||
1379 | 1379 | |
1380 | 1380 | protected static $eolChars; |
1381 | 1381 | |
1382 | - /** |
|
1383 | - * Detects the most used end-of-line character in the subject string. |
|
1384 | - * |
|
1385 | - * @param string $subjectString The string to check. |
|
1386 | - * @return NULL|ConvertHelper_EOL The detected EOL instance, or NULL if none has been detected. |
|
1387 | - */ |
|
1382 | + /** |
|
1383 | + * Detects the most used end-of-line character in the subject string. |
|
1384 | + * |
|
1385 | + * @param string $subjectString The string to check. |
|
1386 | + * @return NULL|ConvertHelper_EOL The detected EOL instance, or NULL if none has been detected. |
|
1387 | + */ |
|
1388 | 1388 | public static function detectEOLCharacter(string $subjectString) : ?ConvertHelper_EOL |
1389 | 1389 | { |
1390 | 1390 | if(empty($subjectString)) { |
@@ -1396,27 +1396,27 @@ discard block |
||
1396 | 1396 | $cr = chr((int)hexdec('0d')); |
1397 | 1397 | $lf = chr((int)hexdec('0a')); |
1398 | 1398 | |
1399 | - self::$eolChars = array( |
|
1400 | - array( |
|
1401 | - 'char' => $cr.$lf, |
|
1402 | - 'type' => ConvertHelper_EOL::TYPE_CRLF, |
|
1403 | - 'description' => t('Carriage return followed by a line feed'), |
|
1404 | - ), |
|
1405 | - array( |
|
1406 | - 'char' => $lf.$cr, |
|
1407 | - 'type' => ConvertHelper_EOL::TYPE_LFCR, |
|
1408 | - 'description' => t('Line feed followed by a carriage return'), |
|
1409 | - ), |
|
1410 | - array( |
|
1411 | - 'char' => $lf, |
|
1412 | - 'type' => ConvertHelper_EOL::TYPE_LF, |
|
1413 | - 'description' => t('Line feed'), |
|
1414 | - ), |
|
1415 | - array( |
|
1416 | - 'char' => $cr, |
|
1417 | - 'type' => ConvertHelper_EOL::TYPE_CR, |
|
1418 | - 'description' => t('Carriage Return'), |
|
1419 | - ), |
|
1399 | + self::$eolChars = array( |
|
1400 | + array( |
|
1401 | + 'char' => $cr.$lf, |
|
1402 | + 'type' => ConvertHelper_EOL::TYPE_CRLF, |
|
1403 | + 'description' => t('Carriage return followed by a line feed'), |
|
1404 | + ), |
|
1405 | + array( |
|
1406 | + 'char' => $lf.$cr, |
|
1407 | + 'type' => ConvertHelper_EOL::TYPE_LFCR, |
|
1408 | + 'description' => t('Line feed followed by a carriage return'), |
|
1409 | + ), |
|
1410 | + array( |
|
1411 | + 'char' => $lf, |
|
1412 | + 'type' => ConvertHelper_EOL::TYPE_LF, |
|
1413 | + 'description' => t('Line feed'), |
|
1414 | + ), |
|
1415 | + array( |
|
1416 | + 'char' => $cr, |
|
1417 | + 'type' => ConvertHelper_EOL::TYPE_CR, |
|
1418 | + 'description' => t('Carriage Return'), |
|
1419 | + ), |
|
1420 | 1420 | ); |
1421 | 1421 | } |
1422 | 1422 | |
@@ -1444,13 +1444,13 @@ discard block |
||
1444 | 1444 | ); |
1445 | 1445 | } |
1446 | 1446 | |
1447 | - /** |
|
1448 | - * Removes the specified keys from the target array, |
|
1449 | - * if they exist. |
|
1450 | - * |
|
1451 | - * @param array $array |
|
1452 | - * @param array $keys |
|
1453 | - */ |
|
1447 | + /** |
|
1448 | + * Removes the specified keys from the target array, |
|
1449 | + * if they exist. |
|
1450 | + * |
|
1451 | + * @param array $array |
|
1452 | + * @param array $keys |
|
1453 | + */ |
|
1454 | 1454 | public static function arrayRemoveKeys(array &$array, array $keys) : void |
1455 | 1455 | { |
1456 | 1456 | foreach($keys as $key) |
@@ -1461,13 +1461,13 @@ discard block |
||
1461 | 1461 | } |
1462 | 1462 | } |
1463 | 1463 | |
1464 | - /** |
|
1465 | - * Checks if the specified variable is an integer or a string containing an integer. |
|
1466 | - * Accepts both positive and negative integers. |
|
1467 | - * |
|
1468 | - * @param mixed $value |
|
1469 | - * @return bool |
|
1470 | - */ |
|
1464 | + /** |
|
1465 | + * Checks if the specified variable is an integer or a string containing an integer. |
|
1466 | + * Accepts both positive and negative integers. |
|
1467 | + * |
|
1468 | + * @param mixed $value |
|
1469 | + * @return bool |
|
1470 | + */ |
|
1471 | 1471 | public static function isInteger($value) : bool |
1472 | 1472 | { |
1473 | 1473 | if(is_int($value)) { |
@@ -1487,52 +1487,52 @@ discard block |
||
1487 | 1487 | return false; |
1488 | 1488 | } |
1489 | 1489 | |
1490 | - /** |
|
1491 | - * Converts an amount of seconds to a DateInterval object. |
|
1492 | - * |
|
1493 | - * @param int $seconds |
|
1494 | - * @return \DateInterval |
|
1495 | - * @throws ConvertHelper_Exception If the date interval cannot be created. |
|
1496 | - * |
|
1497 | - * @see ConvertHelper::ERROR_CANNOT_GET_DATE_DIFF |
|
1498 | - */ |
|
1490 | + /** |
|
1491 | + * Converts an amount of seconds to a DateInterval object. |
|
1492 | + * |
|
1493 | + * @param int $seconds |
|
1494 | + * @return \DateInterval |
|
1495 | + * @throws ConvertHelper_Exception If the date interval cannot be created. |
|
1496 | + * |
|
1497 | + * @see ConvertHelper::ERROR_CANNOT_GET_DATE_DIFF |
|
1498 | + */ |
|
1499 | 1499 | public static function seconds2interval(int $seconds) : \DateInterval |
1500 | 1500 | { |
1501 | 1501 | return ConvertHelper_DateInterval::fromSeconds($seconds)->getInterval(); |
1502 | 1502 | } |
1503 | 1503 | |
1504 | - /** |
|
1505 | - * Converts a size string like "50 MB" to the corresponding byte size. |
|
1506 | - * It is case insensitive, ignores spaces, and supports both traditional |
|
1507 | - * "MB" and "MiB" notations. |
|
1508 | - * |
|
1509 | - * @param string $size |
|
1510 | - * @return int |
|
1511 | - */ |
|
1504 | + /** |
|
1505 | + * Converts a size string like "50 MB" to the corresponding byte size. |
|
1506 | + * It is case insensitive, ignores spaces, and supports both traditional |
|
1507 | + * "MB" and "MiB" notations. |
|
1508 | + * |
|
1509 | + * @param string $size |
|
1510 | + * @return int |
|
1511 | + */ |
|
1512 | 1512 | public static function size2bytes(string $size) : int |
1513 | 1513 | { |
1514 | 1514 | return self::parseSize($size)->toBytes(); |
1515 | 1515 | } |
1516 | 1516 | |
1517 | - /** |
|
1518 | - * Parses a size string like "50 MB" and returns a size notation instance |
|
1519 | - * that has utility methods to access information on it, and convert it. |
|
1520 | - * |
|
1521 | - * @param string $size |
|
1522 | - * @return ConvertHelper_SizeNotation |
|
1523 | - */ |
|
1517 | + /** |
|
1518 | + * Parses a size string like "50 MB" and returns a size notation instance |
|
1519 | + * that has utility methods to access information on it, and convert it. |
|
1520 | + * |
|
1521 | + * @param string $size |
|
1522 | + * @return ConvertHelper_SizeNotation |
|
1523 | + */ |
|
1524 | 1524 | public static function parseSize(string $size) : ConvertHelper_SizeNotation |
1525 | 1525 | { |
1526 | 1526 | return new ConvertHelper_SizeNotation($size); |
1527 | 1527 | } |
1528 | 1528 | |
1529 | - /** |
|
1530 | - * Creates a URL finder instance, which can be used to find |
|
1531 | - * URLs in a string - be it plain text, or HTML. |
|
1532 | - * |
|
1533 | - * @param string $subject |
|
1534 | - * @return ConvertHelper_URLFinder |
|
1535 | - */ |
|
1529 | + /** |
|
1530 | + * Creates a URL finder instance, which can be used to find |
|
1531 | + * URLs in a string - be it plain text, or HTML. |
|
1532 | + * |
|
1533 | + * @param string $subject |
|
1534 | + * @return ConvertHelper_URLFinder |
|
1535 | + */ |
|
1536 | 1536 | public static function createURLFinder(string $subject) : ConvertHelper_URLFinder |
1537 | 1537 | { |
1538 | 1538 | return new ConvertHelper_URLFinder($subject); |
@@ -13,15 +13,15 @@ |
||
13 | 13 | return print_r($result, true); |
14 | 14 | } |
15 | 15 | |
16 | - protected function traverseArray(array $array, int $level=0) : array |
|
16 | + protected function traverseArray(array $array, int $level = 0) : array |
|
17 | 17 | { |
18 | 18 | $result = array(); |
19 | 19 | |
20 | - foreach($array as $key => $val) |
|
20 | + foreach ($array as $key => $val) |
|
21 | 21 | { |
22 | - if(is_array($val)) |
|
22 | + if (is_array($val)) |
|
23 | 23 | { |
24 | - $result[$key] = $this->traverseArray($val, ($level+1)); |
|
24 | + $result[$key] = $this->traverseArray($val, ($level + 1)); |
|
25 | 25 | } |
26 | 26 | else |
27 | 27 | { |
@@ -22,8 +22,7 @@ |
||
22 | 22 | if(is_array($val)) |
23 | 23 | { |
24 | 24 | $result[$key] = $this->traverseArray($val, ($level+1)); |
25 | - } |
|
26 | - else |
|
25 | + } else |
|
27 | 26 | { |
28 | 27 | $result[$key] = parseVariable($val)->toString(); |
29 | 28 | } |