Completed
Pull Request — master (#608)
by Amrouche
03:27
created
src/Serializer/ItemNormalizer.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -293,6 +293,7 @@
 block discarded – undo
293 293
      * @param string           $className
294 294
      * @param mixed            $value
295 295
      * @param array            $context
296
+     * @param string|null $format
296 297
      *
297 298
      * @throws InvalidArgumentException
298 299
      *
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
57 57
         $this->formats = $formats;
58 58
         
59
-        $this->setCircularReferenceHandler(function ($object) {
59
+        $this->setCircularReferenceHandler(function($object) {
60 60
             return $this->iriConverter->getIriFromItem($object);
61 61
         });
62 62
     }
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
             return $rawData;
97 97
         }
98 98
 
99
-        if(isset($context['jsonld_has_context'])) {
99
+        if (isset($context['jsonld_has_context'])) {
100 100
             $data['@id'] = $this->iriConverter->getIriFromItem($object);
101 101
             $data['@type'] = ($iri = $resourceMetadata->getIri()) ? $iri : $resourceMetadata->getShortName();
102 102
         }
103 103
 
104
-        if(isset($context['jsonhal_has_context'])) {
104
+        if (isset($context['jsonhal_has_context'])) {
105 105
             $data['_links']['self']['href'] = $this->iriConverter->getIriFromItem($object);
106 106
         }
107 107
 
Please login to merge, or discard this patch.
src/Serializer/ContextTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
      */
33 33
     private function createContext(string $resourceClass, array $context, array $format) : array
34 34
     {
35
-        if(in_array('application/ld+json', $format)) {
35
+        if (in_array('application/ld+json', $format)) {
36 36
             return $this->createJsonLdContext($resourceClass, $context);
37 37
         }
38 38
 
39
-        if(in_array('application/hal+json', $format)) {
39
+        if (in_array('application/hal+json', $format)) {
40 40
             return $this->createHalContext($resourceClass, $context);
41 41
         }
42 42
         return $context;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     private function addContext(ContextBuilderInterface $contextBuilder, string $resourceClass, array $context, array $data = [], array $format) : array
100 100
     {
101
-        if (in_array('application/ld+json' , $format)) {
101
+        if (in_array('application/ld+json', $format)) {
102 102
             if (isset($context['jsonld_has_context'])) {
103 103
                 return $data;
104 104
             }
Please login to merge, or discard this patch.
src/Serializer/CollectionNormalizer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         $data = $this->addContext($this->contextBuilder, $resourceClass, $context, [], $this->formats[$format]);
78 78
         $context = $this->createContext($resourceClass, $context, $this->formats[$format]);
79 79
 
80
-        if(isset($context['jsonld_has_context'])) {
80
+        if (isset($context['jsonld_has_context'])) {
81 81
 
82 82
             $data['@id'] = $this->iriConverter->getIriFromResourceClass($resourceClass);
83 83
             $data['@type'] = 'hydra:Collection';
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             );
93 93
         }
94 94
 
95
-        if(isset($context['jsonhal_has_context'])) {
95
+        if (isset($context['jsonhal_has_context'])) {
96 96
             $data = $this->contextBuilder->getHalContext($this->iriConverter->getIriFromResourceClass($resourceClass));
97 97
             $data['_embedded'] = [];
98 98
             foreach ($object as $obj) {
Please login to merge, or discard this patch.
src/Serializer/CollectionFiltersNormalizer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
         $context = $this->createContext($resourceClass, $context, $this->formats[$format]);
97 97
 
98 98
         if ([] !== $currentFilters) {
99
-            if(isset($context['jsonld_has_context'])) {
99
+            if (isset($context['jsonld_has_context'])) {
100 100
                 $data['hydra:search'] = $this->getSearch($resourceClass, $requestParts, $currentFilters, $context);
101 101
             }
102 102
 
103
-            if(isset($context['jsonhal_has_context'])) {
103
+            if (isset($context['jsonhal_has_context'])) {
104 104
                 $data['_links']['self'] = array_merge($data['_links']['self'], $this->getSearch($resourceClass, $requestParts, $currentFilters, $context));
105 105
             }
106 106
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
                 ];
146 146
             }
147 147
         }
148
-        if($context['jsonhal_has_context']) {
148
+        if ($context['jsonhal_has_context']) {
149 149
             return [
150 150
                 'search' => sprintf('%s{?%s}', $parts['path'], implode(',', $variables)),
151 151
             ];
Please login to merge, or discard this patch.
src/Hypermedia/ContextBuilder.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -67,14 +67,14 @@
 block discarded – undo
67 67
         return [
68 68
             '_links' =>
69 69
                 ['self' =>
70
-                     ['href' => $selfLink]
70
+                        ['href' => $selfLink]
71 71
                     ,
72
-                 'curies' => [
73
-                     ['name' => 'ap',
74
-                      'href' => $this->urlGenerator->generate('api_hal_entrypoint').$this->docUri.'#section-{rel}',
75
-                      'templated' => true
76
-                     ],
77
-                 ]
72
+                    'curies' => [
73
+                        ['name' => 'ap',
74
+                        'href' => $this->urlGenerator->generate('api_hal_entrypoint').$this->docUri.'#section-{rel}',
75
+                        'templated' => true
76
+                        ],
77
+                    ]
78 78
                 ]
79 79
         ];
80 80
     }
Please login to merge, or discard this patch.