@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $this->root = $data; |
44 | 44 | } |
45 | 45 | |
46 | - return (string)$data; |
|
46 | + return (string) $data; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | public function visitBoolean($data, array $type, Context $context) |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $this->root = $data; |
53 | 53 | } |
54 | 54 | |
55 | - return (boolean)$data; |
|
55 | + return (boolean) $data; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | public function visitInteger($data, array $type, Context $context) |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $this->root = $data; |
62 | 62 | } |
63 | 63 | |
64 | - return (int)$data; |
|
64 | + return (int) $data; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | public function visitDouble($data, array $type, Context $context) |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $this->root = $data; |
71 | 71 | } |
72 | 72 | |
73 | - return (float)$data; |
|
73 | + return (float) $data; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -43,11 +43,11 @@ |
||
43 | 43 | |
44 | 44 | // Test that the Visitor classes in the config exist |
45 | 45 | $vistorClasses = $config[self::CONFIG_NODE]['cached_visitors']; |
46 | - foreach($vistorClasses as $class){ |
|
47 | - if(!class_exists($class)){ |
|
46 | + foreach ($vistorClasses as $class) { |
|
47 | + if (!class_exists($class)) { |
|
48 | 48 | throw new \Exception("The class '$class' configured in smartbox_core.serialization_cache.cached_visitors does not exist."); |
49 | 49 | } |
50 | - if(!property_exists($class, CacheEventsSubscriber::DATA_PROPERTY)){ |
|
50 | + if (!property_exists($class, CacheEventsSubscriber::DATA_PROPERTY)) { |
|
51 | 51 | throw new \Exception("The class '$class' configured in smartbox_core.serialization_cache.cached_visitors does not have the data property and can not be cached."); |
52 | 52 | } |
53 | 53 | } |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | const DATA_PROPERTY = 'data'; |
18 | 18 | |
19 | 19 | /** @var array */ |
20 | - private $reflectors = []; |
|
20 | + private $reflectors = []; |
|
21 | 21 | |
22 | 22 | public function __construct(array $vistorClasses) |
23 | 23 | { |
24 | - foreach ($vistorClasses as $class){ |
|
24 | + foreach ($vistorClasses as $class) { |
|
25 | 25 | $reflector = new \ReflectionProperty($class, self::DATA_PROPERTY); |
26 | 26 | $reflector->setAccessible(true); |
27 | 27 | $this->reflectors[$class] = $reflector; |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | { |
50 | 50 | $data = $event->getObject(); |
51 | 51 | |
52 | - if( !$data instanceof SerializerCacheableInterface ){ |
|
52 | + if (!$data instanceof SerializerCacheableInterface) { |
|
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
56 | 56 | $visitor = $event->getVisitor(); |
57 | 57 | $visitorClass = get_class($visitor); |
58 | 58 | |
59 | - if ( array_key_exists($visitorClass, $this->reflectors) ) { |
|
59 | + if (array_key_exists($visitorClass, $this->reflectors)) { |
|
60 | 60 | $key = CachedObjectHandler::getDataCacheKey($data, $event->getContext()); |
61 | 61 | if ($key !== null && $this->getCacheService()->exists($key, self::KEY_EXISTS_TIMEOUT)) { |
62 | 62 | $event->setType(CachedObjectHandler::TYPE); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $object = $event->getObject(); |
70 | 70 | $typeName = $event->getType()['name']; |
71 | 71 | |
72 | - if( $typeName === CachedObjectHandler::TYPE || !$object instanceof SerializerCacheableInterface ){ |
|
72 | + if ($typeName === CachedObjectHandler::TYPE || !$object instanceof SerializerCacheableInterface) { |
|
73 | 73 | return; |
74 | 74 | } |
75 | 75 |