Passed
Push — master ( c7d0f6...2024b7 )
by Anton
02:21
created
src/Domain/CycleInterceptor.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -45,22 +45,22 @@  discard block
 block discarded – undo
45 45
     {
46 46
         $entities = $this->getDeclaredEntities($controller, $action);
47 47
 
48
-        foreach ($entities as $parameter => $role) {
48
+        foreach ($entities as $parameter => $role){
49 49
             $value = $this->getParameter($parameter, $parameters, count($entities) === 1);
50
-            if ($value === null) {
50
+            if ($value === null){
51 51
                 throw new ControllerException(
52 52
                     "Entity `{$role}` can not be found",
53 53
                     ControllerException::NOT_FOUND
54 54
                 );
55 55
             }
56 56
 
57
-            if (is_object($value)) {
57
+            if (is_object($value)){
58 58
                 // pre-filled
59 59
                 continue;
60 60
             }
61 61
 
62 62
             $entity = $this->resolveEntity($role, $value);
63
-            if ($entity === null) {
63
+            if ($entity === null){
64 64
                 throw new ControllerException(
65 65
                     "Entity `{$role}` can not be found",
66 66
                     ControllerException::NOT_FOUND
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     protected function getParameter(string $role, array $parameters, bool $useDefault = false)
83 83
     {
84
-        if (!$useDefault) {
84
+        if (!$useDefault){
85 85
             return $parameters[$role] ?? null;
86 86
         }
87 87
 
@@ -106,23 +106,23 @@  discard block
 block discarded – undo
106 106
     private function getDeclaredEntities(string $controller, string $action): array
107 107
     {
108 108
         $key = sprintf('%s:%s', $controller, $action);
109
-        if (array_key_exists($key, $this->cache)) {
109
+        if (array_key_exists($key, $this->cache)){
110 110
             return $this->cache[$key];
111 111
         }
112 112
 
113 113
         $this->cache[$key] = [];
114
-        try {
114
+        try{
115 115
             $method = new \ReflectionMethod($controller, $action);
116
-        } catch (\ReflectionException $e) {
116
+        }catch (\ReflectionException $e){
117 117
             return [];
118 118
         }
119 119
 
120
-        foreach ($method->getParameters() as $parameter) {
121
-            if ($parameter->getClass() === null) {
120
+        foreach ($method->getParameters() as $parameter){
121
+            if ($parameter->getClass() === null){
122 122
                 continue;
123 123
             }
124 124
 
125
-            if ($this->orm->getSchema()->defines($parameter->getClass()->getName())) {
125
+            if ($this->orm->getSchema()->defines($parameter->getClass()->getName())){
126 126
                 $this->cache[$key][$parameter->getName()] = $this->orm->resolveRole($parameter->getClass()->getName());
127 127
             }
128 128
         }
Please login to merge, or discard this patch.