Passed
Pull Request — master (#737)
by butschster
18:08 queued 05:08
created
src/Framework/Domain/FilterWithAttributeInterceptor.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         ReaderInterface $reader,
31 31
         ?RenderErrorsInterface $renderErrors = null,
32 32
         int $strategy = self::STRATEGY_JSON_RESPONSE
33
-    ) {
33
+    ){
34 34
         parent::__construct($container, $strategy, $renderErrors);
35 35
 
36 36
         $this->reader = $reader;
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     {
44 44
         $filterClass = get_class($filter);
45 45
 
46
-        if (isset($this->renderersCache[$filterClass])) {
46
+        if (isset($this->renderersCache[$filterClass])){
47 47
             return $this->renderersCache[$filterClass]->render($filter);
48 48
         }
49 49
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     {
55 55
         parent::buildCache($parameter, $class, $key);
56 56
 
57
-        if (null !== ($renderWith = $this->reader->firstClassMetadata($class, RenderWith::class))) {
57
+        if (null !== ($renderWith = $this->reader->firstClassMetadata($class, RenderWith::class))){
58 58
             $this->renderersCache[$class->getName()] = $this->container->get($renderWith->getRenderer());
59 59
         }
60 60
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,8 @@  discard block
 block discarded – undo
43 43
     {
44 44
         $filterClass = get_class($filter);
45 45
 
46
-        if (isset($this->renderersCache[$filterClass])) {
46
+        if (isset($this->renderersCache[$filterClass]))
47
+        {
47 48
             return $this->renderersCache[$filterClass]->render($filter);
48 49
         }
49 50
 
@@ -54,7 +55,8 @@  discard block
 block discarded – undo
54 55
     {
55 56
         parent::buildCache($parameter, $class, $key);
56 57
 
57
-        if (null !== ($renderWith = $this->reader->firstClassMetadata($class, RenderWith::class))) {
58
+        if (null !== ($renderWith = $this->reader->firstClassMetadata($class, RenderWith::class)))
59
+        {
58 60
             $this->renderersCache[$class->getName()] = $this->container->get($renderWith->getRenderer());
59 61
         }
60 62
     }
Please login to merge, or discard this patch.
src/Framework/Domain/FilterInterceptor.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         ContainerInterface $container,
39 39
         int $strategy = self::STRATEGY_JSON_RESPONSE,
40 40
         ?RenderErrorsInterface $renderErrors = null
41
-    ) {
41
+    ){
42 42
         $this->container = $container;
43 43
         $this->strategy = $strategy;
44 44
         $this->renderErrors = $renderErrors ?? new DefaultFilterErrorsRendererInterface($strategy);
@@ -49,20 +49,20 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function process(string $controller, string $action, array $parameters, CoreInterface $core)
51 51
     {
52
-        foreach ($this->getDeclaredFilters($controller, $action) as $parameter => $filterClass) {
53
-            if (isset($parameters[$parameter])) {
52
+        foreach ($this->getDeclaredFilters($controller, $action) as $parameter => $filterClass){
53
+            if (isset($parameters[$parameter])){
54 54
                 continue;
55 55
             }
56 56
 
57 57
             /** @var FilterInterface $filter */
58 58
             $filter = $this->container->get($filterClass);
59 59
 
60
-            if (isset($parameters['@context'])) {
60
+            if (isset($parameters['@context'])){
61 61
                 // other interceptors can define the validation context
62 62
                 $filter->setContext($parameters['@context']);
63 63
             }
64 64
 
65
-            if (!$filter->isValid()) {
65
+            if (!$filter->isValid()){
66 66
                 return $this->renderInvalid($filter);
67 67
             }
68 68
 
@@ -83,25 +83,25 @@  discard block
 block discarded – undo
83 83
     private function getDeclaredFilters(string $controller, string $action): array
84 84
     {
85 85
         $key = sprintf('%s:%s', $controller, $action);
86
-        if (array_key_exists($key, $this->cache)) {
86
+        if (array_key_exists($key, $this->cache)){
87 87
             return $this->cache[$key];
88 88
         }
89 89
 
90 90
         $this->cache[$key] = [];
91
-        try {
91
+        try{
92 92
             $method = new \ReflectionMethod($controller, $action);
93
-        } catch (\ReflectionException $e) {
93
+        }catch (\ReflectionException $e){
94 94
             return [];
95 95
         }
96 96
 
97
-        foreach ($method->getParameters() as $parameter) {
97
+        foreach ($method->getParameters() as $parameter){
98 98
             $class = $this->getParameterClass($parameter);
99 99
 
100
-            if ($class === null) {
100
+            if ($class === null){
101 101
                 continue;
102 102
             }
103 103
 
104
-            if ($class->implementsInterface(FilterInterface::class)) {
104
+            if ($class->implementsInterface(FilterInterface::class)){
105 105
                 $this->buildCache($parameter, $class, $key);
106 106
             }
107 107
         }
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
     {
114 114
         $type = $parameter->getType();
115 115
 
116
-        if (!$type instanceof \ReflectionNamedType) {
116
+        if (!$type instanceof \ReflectionNamedType){
117 117
             return null;
118 118
         }
119 119
 
120
-        if ($type->isBuiltin()) {
120
+        if ($type->isBuiltin()){
121 121
             return null;
122 122
         }
123 123
 
Please login to merge, or discard this patch.
Braces   +25 added lines, -12 removed lines patch added patch discarded remove patch
@@ -49,20 +49,24 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function process(string $controller, string $action, array $parameters, CoreInterface $core)
51 51
     {
52
-        foreach ($this->getDeclaredFilters($controller, $action) as $parameter => $filterClass) {
53
-            if (isset($parameters[$parameter])) {
52
+        foreach ($this->getDeclaredFilters($controller, $action) as $parameter => $filterClass)
53
+        {
54
+            if (isset($parameters[$parameter]))
55
+            {
54 56
                 continue;
55 57
             }
56 58
 
57 59
             /** @var FilterInterface $filter */
58 60
             $filter = $this->container->get($filterClass);
59 61
 
60
-            if (isset($parameters['@context'])) {
62
+            if (isset($parameters['@context']))
63
+            {
61 64
                 // other interceptors can define the validation context
62 65
                 $filter->setContext($parameters['@context']);
63 66
             }
64 67
 
65
-            if (!$filter->isValid()) {
68
+            if (!$filter->isValid())
69
+            {
66 70
                 return $this->renderInvalid($filter);
67 71
             }
68 72
 
@@ -83,25 +87,32 @@  discard block
 block discarded – undo
83 87
     private function getDeclaredFilters(string $controller, string $action): array
84 88
     {
85 89
         $key = sprintf('%s:%s', $controller, $action);
86
-        if (array_key_exists($key, $this->cache)) {
90
+        if (array_key_exists($key, $this->cache))
91
+        {
87 92
             return $this->cache[$key];
88 93
         }
89 94
 
90 95
         $this->cache[$key] = [];
91
-        try {
96
+        try
97
+        {
92 98
             $method = new \ReflectionMethod($controller, $action);
93
-        } catch (\ReflectionException $e) {
99
+        }
100
+        catch (\ReflectionException $e)
101
+        {
94 102
             return [];
95 103
         }
96 104
 
97
-        foreach ($method->getParameters() as $parameter) {
105
+        foreach ($method->getParameters() as $parameter)
106
+        {
98 107
             $class = $this->getParameterClass($parameter);
99 108
 
100
-            if ($class === null) {
109
+            if ($class === null)
110
+            {
101 111
                 continue;
102 112
             }
103 113
 
104
-            if ($class->implementsInterface(FilterInterface::class)) {
114
+            if ($class->implementsInterface(FilterInterface::class))
115
+            {
105 116
                 $this->buildCache($parameter, $class, $key);
106 117
             }
107 118
         }
@@ -113,11 +124,13 @@  discard block
 block discarded – undo
113 124
     {
114 125
         $type = $parameter->getType();
115 126
 
116
-        if (!$type instanceof \ReflectionNamedType) {
127
+        if (!$type instanceof \ReflectionNamedType)
128
+        {
117 129
             return null;
118 130
         }
119 131
 
120
-        if ($type->isBuiltin()) {
132
+        if ($type->isBuiltin())
133
+        {
121 134
             return null;
122 135
         }
123 136
 
Please login to merge, or discard this patch.