Passed
Pull Request — master (#737)
by Vadim
07:15
created
src/Framework/Domain/DefaultFilterRenderer.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,8 @@
 block discarded – undo
28 28
      */
29 29
     public function render(FilterInterface $filter)
30 30
     {
31
-        switch ($this->strategy) {
31
+        switch ($this->strategy)
32
+        {
32 33
             case self::STRATEGY_JSON_RESPONSE:
33 34
                 return [
34 35
                     'status' => 400,
Please login to merge, or discard this patch.
src/Framework/Domain/FilterInterceptor.php 1 patch
Braces   +27 added lines, -13 removed lines patch added patch discarded remove patch
@@ -57,20 +57,24 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function process(string $controller, string $action, array $parameters, CoreInterface $core)
59 59
     {
60
-        foreach ($this->getDeclaredFilters($controller, $action) as $parameter => $filterClass) {
61
-            if (isset($parameters[$parameter])) {
60
+        foreach ($this->getDeclaredFilters($controller, $action) as $parameter => $filterClass)
61
+        {
62
+            if (isset($parameters[$parameter]))
63
+            {
62 64
                 continue;
63 65
             }
64 66
 
65 67
             /** @var FilterInterface $filter */
66 68
             $filter = $this->container->get($filterClass);
67 69
 
68
-            if (isset($parameters['@context'])) {
70
+            if (isset($parameters['@context']))
71
+            {
69 72
                 // other interceptors can define the validation contex
70 73
                 $filter->setContext($parameters['@context']);
71 74
             }
72 75
 
73
-            if (!$filter->isValid()) {
76
+            if (!$filter->isValid())
77
+            {
74 78
                 return $this->renderInvalid($filter);
75 79
             }
76 80
 
@@ -99,28 +103,36 @@  discard block
 block discarded – undo
99 103
     private function getDeclaredFilters(string $controller, string $action): array
100 104
     {
101 105
         $key = sprintf('%s:%s', $controller, $action);
102
-        if (array_key_exists($key, $this->cache)) {
106
+        if (array_key_exists($key, $this->cache))
107
+        {
103 108
             return $this->cache[$key];
104 109
         }
105 110
 
106 111
         $this->cache[$key] = [];
107
-        try {
112
+        try
113
+        {
108 114
             $method = new \ReflectionMethod($controller, $action);
109
-        } catch (\ReflectionException $e) {
115
+        }
116
+        catch (\ReflectionException $e)
117
+        {
110 118
             return [];
111 119
         }
112 120
 
113
-        foreach ($method->getParameters() as $parameter) {
121
+        foreach ($method->getParameters() as $parameter)
122
+        {
114 123
             $class = $this->getParameterClass($parameter);
115 124
 
116
-            if ($class === null) {
125
+            if ($class === null)
126
+            {
117 127
                 continue;
118 128
             }
119 129
 
120
-            if ($class->implementsInterface(FilterInterface::class)) {
130
+            if ($class->implementsInterface(FilterInterface::class))
131
+            {
121 132
                 $this->cache[$key][$parameter->getName()] = $class->getName();
122 133
 
123
-                if (null !== ($renderWith = $this->reader->firstClassMetadata($class, RenderWith::class))) {
134
+                if (null !== ($renderWith = $this->reader->firstClassMetadata($class, RenderWith::class)))
135
+                {
124 136
                     $this->renderersCache[$class->getName()] = $this->container->get($renderWith->getRenderer());
125 137
                 }
126 138
             }
@@ -139,11 +151,13 @@  discard block
 block discarded – undo
139 151
     {
140 152
         $type = $parameter->getType();
141 153
 
142
-        if (!$type instanceof \ReflectionNamedType) {
154
+        if (!$type instanceof \ReflectionNamedType)
155
+        {
143 156
             return null;
144 157
         }
145 158
 
146
-        if ($type->isBuiltin()) {
159
+        if ($type->isBuiltin())
160
+        {
147 161
             return null;
148 162
         }
149 163
 
Please login to merge, or discard this patch.