@@ -55,8 +55,8 @@ public function serialize($value)
5555 {
5656 $ this ->noMappingGuard ();
5757
58- if (is_array ($ value ) && !empty ($ value [Serializer::MAP_TYPE ])) {
59- $ data = ['total ' => count ($ value )];
58+ if (\ is_array ($ value ) && !empty ($ value [Serializer::MAP_TYPE ])) {
59+ $ data = ['total ' => \ count ($ value )];
6060 unset($ value [Serializer::MAP_TYPE ]);
6161 foreach ($ value [Serializer::SCALAR_VALUE ] as $ v ) {
6262 $ data [self ::EMBEDDED_KEY ][] = $ this ->serializeObject ($ v );
@@ -65,7 +65,7 @@ public function serialize($value)
6565 $ data = $ this ->serializeObject ($ value );
6666 }
6767
68- return json_encode ($ data , JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES );
68+ return \ json_encode ($ data , JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES );
6969 }
7070
7171 /**
@@ -117,7 +117,7 @@ private function serialization(array $data)
117117 private function setEmbeddedResources (array &$ data )
118118 {
119119 foreach ($ data as $ propertyName => &$ value ) {
120- if (is_array ($ value )) {
120+ if (\ is_array ($ value )) {
121121 $ this ->setEmbeddedForResource ($ data , $ value , $ propertyName );
122122 $ this ->setEmbeddedForResourceArray ($ data , $ value , $ propertyName );
123123 }
@@ -133,11 +133,11 @@ private function setEmbeddedForResource(array &$data, array &$value, $propertyNa
133133 {
134134 if (!empty ($ value [Serializer::CLASS_IDENTIFIER_KEY ])) {
135135 $ type = $ value [Serializer::CLASS_IDENTIFIER_KEY ];
136- if (is_scalar ($ type )) {
136+ if (\ is_scalar ($ type )) {
137137 $ idProperties = $ this ->mappings [$ type ]->getIdProperties ();
138138 CuriesHelper::addCurieForResource ($ this ->mappings , $ this ->curies , $ type );
139139
140- if (false === in_array ($ propertyName , $ idProperties )) {
140+ if (false === \ in_array ($ propertyName , $ idProperties )) {
141141 $ data [self ::EMBEDDED_KEY ][$ propertyName ] = $ value ;
142142
143143 list ($ idValues , $ idProperties ) = RecursiveFormatterHelper::getIdPropertyAndValues (
@@ -199,7 +199,7 @@ private function addEmbeddedResourceAdditionalLinks(array &$data, array &$value,
199199 $ links = $ data [self ::EMBEDDED_KEY ][$ propertyName ][self ::LINKS_KEY ];
200200 }
201201
202- $ data [self ::EMBEDDED_KEY ][$ propertyName ][self ::LINKS_KEY ] = array_merge (
202+ $ data [self ::EMBEDDED_KEY ][$ propertyName ][self ::LINKS_KEY ] = \ array_merge (
203203 $ links ,
204204 $ this ->addHrefToLinks ($ this ->getResponseAdditionalLinks ($ value , $ type ))
205205 );
@@ -252,7 +252,7 @@ private function getPropertyNameWithCurie($type, $propertyName)
252252 {
253253 $ curie = $ this ->mappings [$ type ]->getCuries ();
254254 if (!empty ($ curie )) {
255- $ propertyName = sprintf (
255+ $ propertyName = \ sprintf (
256256 '%s:%s ' ,
257257 $ curie ['name ' ],
258258 self ::camelCaseToUnderscore ($ propertyName )
@@ -298,7 +298,7 @@ private function setEmbeddedForResourceArray(array &$data, array &$value, $prope
298298 {
299299 if (!empty ($ value [Serializer::MAP_TYPE ])) {
300300 foreach ($ value as &$ arrayValue ) {
301- if (is_array ($ arrayValue )) {
301+ if (\ is_array ($ arrayValue )) {
302302 $ this ->setEmbeddedArrayValue ($ data , $ propertyName , $ arrayValue );
303303 }
304304 }
@@ -334,7 +334,7 @@ private function setEmbeddedArrayValue(array &$data, $propertyName, array &$arra
334334 */
335335 private function isResourceInArray ($ inArrayValue )
336336 {
337- return is_array ($ inArrayValue ) && !empty ($ inArrayValue [Serializer::CLASS_IDENTIFIER_KEY ]);
337+ return \ is_array ($ inArrayValue ) && !empty ($ inArrayValue [Serializer::CLASS_IDENTIFIER_KEY ]);
338338 }
339339
340340 /**
@@ -376,14 +376,14 @@ private function addArrayValueResourceToEmbedded(
376376 protected function setResponseLinks (array &$ data )
377377 {
378378 if (!empty ($ data [Serializer::CLASS_IDENTIFIER_KEY ])) {
379- $ data [self ::LINKS_KEY ] = array_merge (
379+ $ data [self ::LINKS_KEY ] = \ array_merge (
380380 CuriesHelper::buildCuries ($ this ->curies ),
381381 $ this ->addHrefToLinks ($ this ->buildLinks ()),
382382 (!empty ($ data [self ::LINKS_KEY ])) ? $ data [self ::LINKS_KEY ] : [],
383383 $ this ->addHrefToLinks ($ this ->getResponseAdditionalLinks ($ data , $ data [Serializer::CLASS_IDENTIFIER_KEY ]))
384384 );
385385
386- $ data [self ::LINKS_KEY ] = array_filter ($ data [self ::LINKS_KEY ]);
386+ $ data [self ::LINKS_KEY ] = \ array_filter ($ data [self ::LINKS_KEY ]);
387387
388388 if (empty ($ data [self ::LINKS_KEY ])) {
389389 unset($ data [self ::LINKS_KEY ]);
@@ -429,7 +429,7 @@ private function setResponseMeta(array &$response)
429429 */
430430 private static function buildUrl (array &$ mappings , $ idProperties , $ idValues , $ url , $ type )
431431 {
432- $ outputUrl = str_replace ($ idProperties , $ idValues , $ url );
432+ $ outputUrl = \ str_replace ($ idProperties , $ idValues , $ url );
433433 if ($ outputUrl !== $ url ) {
434434 return $ outputUrl ;
435435 }
@@ -441,8 +441,8 @@ private static function buildUrl(array &$mappings, $idProperties, $idValues, $ur
441441 }
442442
443443 $ className = $ mappings [$ type ]->getClassName ();
444- $ className = explode ('\\' , $ className );
445- $ className = array_pop ($ className );
444+ $ className = \ explode ('\\' , $ className );
445+ $ className = \ array_pop ($ className );
446446
447447 $ outputUrl = self ::secondPassBuildUrl ([$ className ], $ idValues , $ url );
448448 if ($ outputUrl !== $ url ) {
@@ -494,7 +494,7 @@ private static function toCamelCase($original, $idValues, $url)
494494 $ o = '{ ' .self ::underscoreToCamelCase (self ::camelCaseToUnderscore ($ o )).'} ' ;
495495 }
496496
497- return str_replace ($ original , $ idValues , $ url );
497+ return \ str_replace ($ original , $ idValues , $ url );
498498 }
499499
500500 /**
@@ -508,11 +508,11 @@ private static function toLowerFirstCamelCase($original, $idValues, $url)
508508 {
509509 foreach ($ original as &$ o ) {
510510 $ o = self ::underscoreToCamelCase (self ::camelCaseToUnderscore ($ o ));
511- $ o [0 ] = strtolower ($ o [0 ]);
511+ $ o [0 ] = \ strtolower ($ o [0 ]);
512512 $ o = '{ ' .$ o .'} ' ;
513513 }
514514
515- return str_replace ($ original , $ idValues , $ url );
515+ return \ str_replace ($ original , $ idValues , $ url );
516516 }
517517
518518 /**
@@ -528,7 +528,7 @@ private static function toUnderScore($original, $idValues, $url)
528528 $ o = '{ ' .self ::camelCaseToUnderscore ($ o ).'} ' ;
529529 }
530530
531- return str_replace ($ original , $ idValues , $ url );
531+ return \ str_replace ($ original , $ idValues , $ url );
532532 }
533533
534534 /**
@@ -541,13 +541,13 @@ private static function toUnderScore($original, $idValues, $url)
541541 */
542542 private static function camelCaseToUnderscore ($ camel , $ splitter = '_ ' )
543543 {
544- $ camel = preg_replace (
544+ $ camel = \ preg_replace (
545545 '/(?!^)[[:upper:]][[:lower:]]/ ' ,
546546 '$0 ' ,
547- preg_replace ('/(?!^)[[:upper:]]+/ ' , $ splitter .'$0 ' , $ camel )
547+ \ preg_replace ('/(?!^)[[:upper:]]+/ ' , $ splitter .'$0 ' , $ camel )
548548 );
549549
550- return strtolower ($ camel );
550+ return \ strtolower ($ camel );
551551 }
552552
553553 /**
@@ -559,6 +559,6 @@ private static function camelCaseToUnderscore($camel, $splitter = '_')
559559 */
560560 private static function underscoreToCamelCase ($ string )
561561 {
562- return str_replace (' ' , '' , ucwords (strtolower (str_replace (['_ ' , '- ' ], ' ' , $ string ))));
562+ return \ str_replace (' ' , '' , \ ucwords (\ strtolower (\ str_replace (['_ ' , '- ' ], ' ' , $ string ))));
563563 }
564564}
0 commit comments