@@ -77,14 +77,14 @@ class Serializer
7777 */
7878 public function __construct (StrategyInterface $ strategy )
7979 {
80- $ this ->isHHVM = defined ('HHVM_VERSION ' );
80+ $ this ->isHHVM = \ defined ('HHVM_VERSION ' );
8181 if ($ this ->isHHVM ) {
8282 // @codeCoverageIgnoreStart
83- $ this ->serializationMap = array_merge (
83+ $ this ->serializationMap = \ array_merge (
8484 $ this ->serializationMap ,
85- include realpath (dirname (__FILE__ ).'/Mapping/serialization_hhvm.php ' )
85+ include \ realpath (\ dirname (__FILE__ ).'/Mapping/serialization_hhvm.php ' )
8686 );
87- $ this ->unserializationMapHHVM = include realpath (dirname (__FILE__ ).'/Mapping/unserialization_hhvm.php ' );
87+ $ this ->unserializationMapHHVM = include \ realpath (\ dirname (__FILE__ ).'/Mapping/unserialization_hhvm.php ' );
8888 // @codeCoverageIgnoreEnd
8989 }
9090 $ this ->serializationStrategy = $ strategy ;
@@ -142,15 +142,15 @@ protected function serializeData($value)
142142
143143 if ($ this ->isHHVM && ($ value instanceof \DateTimeZone || $ value instanceof \DateInterval)) {
144144 // @codeCoverageIgnoreStart
145- return call_user_func_array ($ this ->serializationMap [get_class ($ value )], [$ this , $ value ]);
145+ return \ call_user_func_array ($ this ->serializationMap [get_class ($ value )], [$ this , $ value ]);
146146 // @codeCoverageIgnoreEnd
147147 }
148148
149- if (is_object ($ value )) {
149+ if (\ is_object ($ value )) {
150150 return $ this ->serializeObject ($ value );
151151 }
152152
153- $ type = (gettype ($ value ) && $ value !== null ) ? gettype ($ value ) : 'string ' ;
153+ $ type = (\ gettype ($ value ) && $ value !== null ) ? \ gettype ($ value ) : 'string ' ;
154154 $ func = $ this ->serializationMap [$ type ];
155155
156156 return $ this ->$ func ($ value );
@@ -173,7 +173,7 @@ protected function guardForUnsupportedValues($value)
173173 );
174174 }
175175
176- if (is_resource ($ value )) {
176+ if (\ is_resource ($ value )) {
177177 throw new SerializerException ('Resource is not supported in Serializer ' );
178178 }
179179 }
@@ -187,7 +187,7 @@ protected function guardForUnsupportedValues($value)
187187 */
188188 public function unserialize ($ value )
189189 {
190- if (is_array ($ value ) && isset ($ value [self ::SCALAR_TYPE ])) {
190+ if (\ is_array ($ value ) && isset ($ value [self ::SCALAR_TYPE ])) {
191191 return $ this ->unserializeData ($ value );
192192 }
193193
@@ -223,7 +223,7 @@ protected function unserializeData($value)
223223 return $ this ->unserializeObject ($ value );
224224 }
225225
226- return array_map ([$ this , __FUNCTION__ ], $ value );
226+ return \ array_map ([$ this , __FUNCTION__ ], $ value );
227227 }
228228
229229 /**
@@ -235,9 +235,9 @@ protected function getScalarValue($value)
235235 {
236236 switch ($ value [self ::SCALAR_TYPE ]) {
237237 case 'integer ' :
238- return intval ($ value [self ::SCALAR_VALUE ]);
238+ return \ intval ($ value [self ::SCALAR_VALUE ]);
239239 case 'float ' :
240- return floatval ($ value [self ::SCALAR_VALUE ]);
240+ return \ floatval ($ value [self ::SCALAR_VALUE ]);
241241 case 'boolean ' :
242242 return $ value [self ::SCALAR_VALUE ];
243243 case 'NULL ' :
@@ -291,7 +291,7 @@ protected function unserializeDateTimeFamilyObject(array $value, $className)
291291 if ($ this ->isDateTimeFamilyObject ($ className )) {
292292 if ($ this ->isHHVM ) {
293293 // @codeCoverageIgnoreStart
294- return call_user_func_array (
294+ return \ call_user_func_array (
295295 $ this ->unserializationMapHHVM [$ className ],
296296 [$ this , $ className , $ value ]
297297 );
@@ -315,7 +315,7 @@ protected function isDateTimeFamilyObject($className)
315315 $ isDateTime = false ;
316316
317317 foreach ($ this ->dateTimeClassType as $ class ) {
318- $ isDateTime = $ isDateTime || is_subclass_of ($ className , $ class , true ) || $ class === $ className ;
318+ $ isDateTime = $ isDateTime || \ is_subclass_of ($ className , $ class , true ) || $ class === $ className ;
319319 }
320320
321321 return $ isDateTime ;
@@ -334,13 +334,13 @@ protected function restoreUsingUnserialize($className, array $attributes)
334334 }
335335
336336 $ obj = (object ) $ attributes ;
337- $ serialized = preg_replace (
337+ $ serialized = \ preg_replace (
338338 '|^O:\d+:"\w+":| ' ,
339339 'O: ' .strlen ($ className ).':" ' .$ className .'": ' ,
340- serialize ($ obj )
340+ \ serialize ($ obj )
341341 );
342342
343- return unserialize ($ serialized );
343+ return \ unserialize ($ serialized );
344344 }
345345
346346 /**
@@ -357,7 +357,7 @@ protected function unserializeUserDefinedObject(array $value, $className)
357357 $ this ->objectMapping [$ this ->objectMappingIndex ++] = $ obj ;
358358 $ this ->setUnserializedObjectProperties ($ value , $ ref , $ obj );
359359
360- if (method_exists ($ obj , '__wakeup ' )) {
360+ if (\ method_exists ($ obj , '__wakeup ' )) {
361361 $ obj ->__wakeup ();
362362 }
363363
@@ -393,7 +393,7 @@ protected function setUnserializedObjectProperties(array $value, ReflectionClass
393393 */
394394 protected function serializeScalar ($ value )
395395 {
396- $ type = gettype ($ value );
396+ $ type = \ gettype ($ value );
397397 if ($ type === 'double ' ) {
398398 $ type = 'float ' ;
399399 }
@@ -411,7 +411,7 @@ protected function serializeScalar($value)
411411 */
412412 protected function serializeArray (array $ value )
413413 {
414- if (array_key_exists (self ::MAP_TYPE , $ value )) {
414+ if (\ array_key_exists (self ::MAP_TYPE , $ value )) {
415415 return $ value ;
416416 }
417417
@@ -455,7 +455,7 @@ protected function serializeInternalClass($value, $className, ReflectionClass $r
455455 {
456456 $ paramsToSerialize = $ this ->getObjectProperties ($ ref , $ value );
457457 $ data = [self ::CLASS_IDENTIFIER_KEY => $ className ];
458- $ data += array_map ([$ this , 'serializeData ' ], $ this ->extractObjectData ($ value , $ ref , $ paramsToSerialize ));
458+ $ data += \ array_map ([$ this , 'serializeData ' ], $ this ->extractObjectData ($ value , $ ref , $ paramsToSerialize ));
459459
460460 return $ data ;
461461 }
@@ -475,7 +475,7 @@ protected function getObjectProperties(ReflectionClass $ref, $value)
475475 $ props [] = $ prop ->getName ();
476476 }
477477
478- return array_unique (array_merge ($ props , array_keys (get_object_vars ($ value ))));
478+ return \ array_unique (\ array_merge ($ props , \ array_keys (\ get_object_vars ($ value ))));
479479 }
480480
481481 /**
@@ -530,7 +530,7 @@ protected function extractAllInhertitedProperties($value, ReflectionClass $rc, a
530530 $ property ->setAccessible (true );
531531 $ rp [$ property ->getName ()] = $ property ->getValue ($ this );
532532 }
533- $ data = array_merge ($ rp , $ data );
533+ $ data = \ array_merge ($ rp , $ data );
534534 } while ($ rc = $ rc ->getParentClass ());
535535 }
536536}
0 commit comments