@@ -56,10 +56,10 @@ public function __construct(array $rules = [], array $default = [], ?string $typ
5656 $ this ->default = $ default ;
5757
5858 // prepare rules
59- $ this ->rules = array_change_key_case ($ rules , CASE_LOWER );
59+ $ this ->rules = \ array_change_key_case ($ rules , \ CASE_LOWER );
6060
6161 foreach ($ this ->rules as $ key => $ item ) {
62- $ this ->rules [$ key ] = array_merge ($ default , (array )$ item );
62+ $ this ->rules [$ key ] = \ array_merge ($ default , (array )$ item );
6363 }
6464 }
6565
@@ -69,7 +69,7 @@ public function __construct(array $rules = [], array $default = [], ?string $typ
6969 */
7070 public function get (string $ rule ): array
7171 {
72- if (array_key_exists ($ rule , $ this ->rules )) {
72+ if (\ array_key_exists ($ rule , $ this ->rules )) {
7373 return (array )$ this ->rules [$ rule ];
7474 }
7575
@@ -83,9 +83,9 @@ public function get(string $rule): array
8383 public function getList (bool $ keysOnly = false ): array
8484 {
8585 if ($ keysOnly ) {
86- $ keys = array_keys ($ this ->rules );
87- $ values = array_keys ($ this ->rules );
88- return array_combine ($ keys , $ values ) ?: [];
86+ $ keys = \ array_keys ($ this ->rules );
87+ $ values = \ array_keys ($ this ->rules );
88+ return \ array_combine ($ keys , $ values ) ?: [];
8989 }
9090
9191 return $ this ->rules ;
@@ -103,13 +103,13 @@ public function text(float $value, string $rule, bool $showSymbol = true): strin
103103 $ rData = $ this ->get ($ rule );
104104 $ symbol = $ showSymbol ? $ rData ['symbol ' ] : '' ;
105105
106- $ result = str_replace (
106+ $ result = \ str_replace (
107107 ['%v ' , '%s ' ],
108108 [$ data ['value ' ], $ symbol ],
109109 $ data ['template ' ]
110110 );
111111
112- return trim ($ result );
112+ return \ trim ($ result );
113113 }
114114
115115 /**
@@ -123,7 +123,7 @@ public function html(array $current, array $orig, array $params): string
123123 $ data = $ this ->format ($ current ['value ' ], $ current ['rule ' ]);
124124 $ rData = $ this ->get ($ current ['rule ' ]);
125125
126- $ result = str_replace (
126+ $ result = \ str_replace (
127127 ['%v ' , '%s ' ],
128128 [
129129 "<span class= \"simpleType-value \"> {$ data ['value ' ]}</span> " ,
@@ -183,16 +183,16 @@ public static function htmlAttributes(array $attributes): string
183183 {
184184 $ result = '' ;
185185
186- if (count ($ attributes )) {
186+ if (\ count ($ attributes )) {
187187 foreach ($ attributes as $ key => $ param ) {
188- $ value = implode (' ' , (array )$ param );
189- $ value = htmlspecialchars ($ value , ENT_QUOTES , 'UTF-8 ' );
190- $ value = trim ($ value );
188+ $ value = \ implode (' ' , (array )$ param );
189+ $ value = \ htmlspecialchars ($ value , \ ENT_QUOTES , 'UTF-8 ' );
190+ $ value = \ trim ($ value );
191191 $ result .= " {$ key }= \"{$ value }\"" ;
192192 }
193193 }
194194
195- return trim ($ result );
195+ return \ trim ($ result );
196196 }
197197
198198 /**
@@ -206,32 +206,32 @@ public function round(float $value, string $rule, array $params = []): float
206206 $ format = $ this ->get ($ rule );
207207
208208 // prepare params
209- $ params = array_merge (['roundType ' => null , 'roundValue ' => null ], $ params );
209+ $ params = \ array_merge (['roundType ' => null , 'roundValue ' => null ], $ params );
210210
211211 // get vars
212212 $ roundType = $ params ['roundType ' ];
213213 $ roundValue = $ params ['roundValue ' ];
214214
215215 if (!$ roundType ) {
216- $ roundType = array_key_exists ('round_type ' , $ format ) ? $ format ['round_type ' ] : self ::ROUND_NONE ;
216+ $ roundType = \ array_key_exists ('round_type ' , $ format ) ? $ format ['round_type ' ] : self ::ROUND_NONE ;
217217 }
218218
219219 if (null === $ roundValue ) {
220- $ roundValue = array_key_exists ('round_value ' , $ format ) ? $ format ['round_value ' ] : self ::ROUND_DEFAULT ;
220+ $ roundValue = \ array_key_exists ('round_value ' , $ format ) ? $ format ['round_value ' ] : self ::ROUND_DEFAULT ;
221221 }
222222
223223 $ roundValue = (int )$ roundValue ;
224224
225225 if (self ::ROUND_CEIL === $ roundType ) {
226226 $ base = 10 ** $ roundValue ;
227- $ value = ceil ($ value * $ base ) / $ base ;
227+ $ value = \ ceil ($ value * $ base ) / $ base ;
228228 } elseif (self ::ROUND_CLASSIC === $ roundType ) {
229- $ value = round ($ value , $ roundValue );
229+ $ value = \ round ($ value , $ roundValue );
230230 } elseif (self ::ROUND_FLOOR === $ roundType ) {
231231 $ base = 10 ** $ roundValue ;
232- $ value = floor ($ value * $ base ) / $ base ;
232+ $ value = \ floor ($ value * $ base ) / $ base ;
233233 } elseif (self ::ROUND_NONE === $ roundType ) {
234- $ value = round ($ value , self ::ROUND_DEFAULT ); // hack, because 123.400000001 !== 123.4
234+ $ value = \ round ($ value , self ::ROUND_DEFAULT ); // hack, because 123.400000001 !== 123.4
235235 } else {
236236 throw new Exception ("Undefined round mode: ' {$ roundType }' " );
237237 }
@@ -251,8 +251,8 @@ protected function format(float $value, string $rule): array
251251
252252 $ roundedValue = $ this ->round ($ value , $ rule );
253253 $ isPositive = ($ value >= 0 );
254- $ valueStr = number_format (
255- abs ($ roundedValue ),
254+ $ valueStr = \ number_format (
255+ \ abs ($ roundedValue ),
256256 (int )($ format ['num_decimals ' ] ?? 0 ),
257257 (string )($ format ['decimal_sep ' ] ?? '. ' ),
258258 (string )($ format ['thousands_sep ' ] ?? '' )
@@ -275,7 +275,7 @@ public function changeRule(string $rule, array $newFormat): void
275275 {
276276 $ oldFormat = $ this ->get ($ rule );
277277
278- $ this ->rules [$ rule ] = array_merge ($ oldFormat , $ newFormat );
278+ $ this ->rules [$ rule ] = \ array_merge ($ oldFormat , $ newFormat );
279279 }
280280
281281 /**
@@ -288,11 +288,11 @@ public function addRule(string $rule, array $newFormat = []): void
288288 throw new Exception ('Empty rule name ' );
289289 }
290290
291- if (array_key_exists ($ rule , $ this ->rules )) {
291+ if (\ array_key_exists ($ rule , $ this ->rules )) {
292292 throw new Exception ("Format ' {$ rule }' already exists " );
293293 }
294294
295- $ this ->rules [$ rule ] = array_merge ($ this ->default , $ newFormat );
295+ $ this ->rules [$ rule ] = \ array_merge ($ this ->default , $ newFormat );
296296 }
297297
298298 /**
@@ -301,7 +301,7 @@ public function addRule(string $rule, array $newFormat = []): void
301301 */
302302 public function removeRule (string $ rule ): bool
303303 {
304- if (array_key_exists ($ rule , $ this ->rules )) {
304+ if (\ array_key_exists ($ rule , $ this ->rules )) {
305305 unset($ this ->rules [$ rule ]);
306306 return true ;
307307 }
0 commit comments