@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | public function testGet(): void |
| 25 | 25 | { |
| 26 | 26 | $loader = new ViewLoader([ |
| 27 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 28 | - 'other' => __DIR__ . '/fixtures/other', |
|
| 27 | + 'default' => __DIR__.'/fixtures/default', |
|
| 28 | + 'other' => __DIR__.'/fixtures/other', |
|
| 29 | 29 | ]); |
| 30 | 30 | |
| 31 | 31 | $loader = $loader->withExtension('php'); |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | public function testRenderWithValue(): void |
| 52 | 52 | { |
| 53 | 53 | $loader = new ViewLoader([ |
| 54 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 55 | - 'other' => __DIR__ . '/fixtures/other', |
|
| 54 | + 'default' => __DIR__.'/fixtures/default', |
|
| 55 | + 'other' => __DIR__.'/fixtures/other', |
|
| 56 | 56 | |
| 57 | 57 | ]); |
| 58 | 58 | |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | $this->expectException(RenderException::class); |
| 71 | 71 | |
| 72 | 72 | $loader = new ViewLoader([ |
| 73 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 74 | - 'other' => __DIR__ . '/fixtures/other', |
|
| 73 | + 'default' => __DIR__.'/fixtures/default', |
|
| 74 | + 'other' => __DIR__.'/fixtures/other', |
|
| 75 | 75 | |
| 76 | 76 | ]); |
| 77 | 77 | |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | public function testRenderBufferWithValue(): void |
| 89 | 89 | { |
| 90 | 90 | $loader = new ViewLoader([ |
| 91 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 92 | - 'other' => __DIR__ . '/fixtures/other', |
|
| 91 | + 'default' => __DIR__.'/fixtures/default', |
|
| 92 | + 'other' => __DIR__.'/fixtures/other', |
|
| 93 | 93 | |
| 94 | 94 | ]); |
| 95 | 95 | |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | $this->expectException(RenderException::class); |
| 108 | 108 | |
| 109 | 109 | $loader = new ViewLoader([ |
| 110 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 111 | - 'other' => __DIR__ . '/fixtures/other', |
|
| 110 | + 'default' => __DIR__.'/fixtures/default', |
|
| 111 | + 'other' => __DIR__.'/fixtures/other', |
|
| 112 | 112 | |
| 113 | 113 | ]); |
| 114 | 114 | |
@@ -54,8 +54,8 @@ |
||
| 54 | 54 | protected function getSource(string $path): ViewSource |
| 55 | 55 | { |
| 56 | 56 | $loader = new ViewLoader([ |
| 57 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 58 | - 'other' => __DIR__ . '/fixtures/other', |
|
| 57 | + 'default' => __DIR__.'/fixtures/default', |
|
| 58 | + 'other' => __DIR__.'/fixtures/other', |
|
| 59 | 59 | ]); |
| 60 | 60 | |
| 61 | 61 | return $loader->withExtension('php')->load($path); |
@@ -130,8 +130,8 @@ |
||
| 130 | 130 | protected function getView(ContextInterface $context, string $path): ViewInterface |
| 131 | 131 | { |
| 132 | 132 | $loader = new ViewLoader([ |
| 133 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 134 | - 'other' => __DIR__ . '/fixtures/other', |
|
| 133 | + 'default' => __DIR__.'/fixtures/default', |
|
| 134 | + 'other' => __DIR__.'/fixtures/other', |
|
| 135 | 135 | ]); |
| 136 | 136 | |
| 137 | 137 | $engine = new NativeEngine(new Container()); |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | private function process(ViewSource $source, ContextInterface $context): ViewSource |
| 31 | 31 | { |
| 32 | - foreach ($this->processors as $processor) { |
|
| 32 | + foreach ($this->processors as $processor){ |
|
| 33 | 33 | $source = $processor->process($source, $context); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -29,7 +29,8 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | private function process(ViewSource $source, ContextInterface $context): ViewSource |
| 31 | 31 | { |
| 32 | - foreach ($this->processors as $processor) { |
|
| 32 | + foreach ($this->processors as $processor) |
|
| 33 | + { |
|
| 33 | 34 | $source = $processor->process($source, $context); |
| 34 | 35 | } |
| 35 | 36 | |
@@ -90,8 +90,8 @@ |
||
| 90 | 90 | $this->assertEquals($allowRule, $manager->getRule(static::ROLE, static::PERMISSION)); |
| 91 | 91 | |
| 92 | 92 | // test pattern permission |
| 93 | - $this->assertEquals($manager, $manager->associate(static::ROLE, static::PERMISSION . '.*', AllowRule::class)); |
|
| 94 | - $this->assertEquals($allowRule, $manager->getRule(static::ROLE, static::PERMISSION . '.' . static::PERMISSION)); |
|
| 93 | + $this->assertEquals($manager, $manager->associate(static::ROLE, static::PERMISSION.'.*', AllowRule::class)); |
|
| 94 | + $this->assertEquals($allowRule, $manager->getRule(static::ROLE, static::PERMISSION.'.'.static::PERMISSION)); |
|
| 95 | 95 | |
| 96 | 96 | $this->assertEquals($manager, $manager->deassociate(static::ROLE, static::PERMISSION)); |
| 97 | 97 | $this->assertEquals($forbidRule, $manager->getRule(static::ROLE, static::PERMISSION)); |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | $this->assertEquals(static::OPERATION, $guarded->resolvePermission(static::OPERATION)); |
| 101 | 101 | |
| 102 | 102 | $guarded = new GuardedWithNamespace(); |
| 103 | - $resolvedPermission = GuardedWithNamespace::GUARD_NAMESPACE . '.' . static::OPERATION; |
|
| 103 | + $resolvedPermission = GuardedWithNamespace::GUARD_NAMESPACE.'.'.static::OPERATION; |
|
| 104 | 104 | $this->assertEquals($resolvedPermission, $guarded->resolvePermission(static::OPERATION)); |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | // other rule types |
| 61 | 61 | $manager->set('RuleInterface', $this->rule); |
| 62 | 62 | $this->assertEquals($this->rule, $manager->get('RuleInterface')); |
| 63 | - $manager->set('Closure', function () { |
|
| 63 | + $manager->set('Closure', function (){ |
|
| 64 | 64 | return true; |
| 65 | 65 | }); |
| 66 | 66 | $this->assertTrue($manager->get('Closure') instanceof CallableRule); |
@@ -60,7 +60,8 @@ |
||
| 60 | 60 | // other rule types |
| 61 | 61 | $manager->set('RuleInterface', $this->rule); |
| 62 | 62 | $this->assertEquals($this->rule, $manager->get('RuleInterface')); |
| 63 | - $manager->set('Closure', function () { |
|
| 63 | + $manager->set('Closure', function () |
|
| 64 | + { |
|
| 64 | 65 | return true; |
| 65 | 66 | }); |
| 66 | 67 | $this->assertTrue($manager->get('Closure') instanceof CallableRule); |
@@ -48,8 +48,10 @@ discard block |
||
| 48 | 48 | public function allows(string $permission, array $context = []): bool |
| 49 | 49 | { |
| 50 | 50 | $allows = false; |
| 51 | - foreach ($this->getRoles() as $role) { |
|
| 52 | - if (!$this->permissions->hasRole($role)) { |
|
| 51 | + foreach ($this->getRoles() as $role) |
|
| 52 | + { |
|
| 53 | + if (!$this->permissions->hasRole($role)) |
|
| 54 | + { |
|
| 53 | 55 | continue; |
| 54 | 56 | } |
| 55 | 57 | |
@@ -95,7 +97,8 @@ discard block |
||
| 95 | 97 | */ |
| 96 | 98 | public function getActor(): ActorInterface |
| 97 | 99 | { |
| 98 | - if (empty($this->actor)) { |
|
| 100 | + if (empty($this->actor)) |
|
| 101 | + { |
|
| 99 | 102 | throw new GuardException('Unable to get Guard Actor, no value set'); |
| 100 | 103 | } |
| 101 | 104 | |
@@ -18,14 +18,14 @@ discard block |
||
| 18 | 18 | private readonly PermissionsInterface $permissions, |
| 19 | 19 | private ?ActorInterface $actor = null, |
| 20 | 20 | private array $roles = [] |
| 21 | - ) { |
|
| 21 | + ){ |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function allows(string $permission, array $context = []): bool |
| 25 | 25 | { |
| 26 | 26 | $allows = false; |
| 27 | - foreach ($this->getRoles() as $role) { |
|
| 28 | - if (!$this->permissions->hasRole($role)) { |
|
| 27 | + foreach ($this->getRoles() as $role){ |
|
| 28 | + if (!$this->permissions->hasRole($role)){ |
|
| 29 | 29 | continue; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function getActor(): ActorInterface |
| 66 | 66 | { |
| 67 | - if (empty($this->actor)) { |
|
| 67 | + if (empty($this->actor)){ |
|
| 68 | 68 | throw new GuardException('Unable to get Guard Actor, no value set'); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -115,17 +115,17 @@ discard block |
||
| 115 | 115 | ]; |
| 116 | 116 | |
| 117 | 117 | $reflectionMethods = []; |
| 118 | - foreach ($reflection->getMethods() as $method) { |
|
| 119 | - if ($method->getDeclaringClass()->name !== $reflection->name) { |
|
| 118 | + foreach ($reflection->getMethods() as $method){ |
|
| 119 | + if ($method->getDeclaringClass()->name !== $reflection->name){ |
|
| 120 | 120 | continue; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | $reflectionMethods[$method->name] = $method; |
| 124 | 124 | $this->assertArrayHasKey($method->name, $methods); |
| 125 | 125 | |
| 126 | - if (!$method->hasReturnType()) { |
|
| 126 | + if (!$method->hasReturnType()){ |
|
| 127 | 127 | $this->assertNull($methods[$method->name]['hint']); |
| 128 | - } else { |
|
| 128 | + }else{ |
|
| 129 | 129 | $this->assertEquals($methods[$method->name]['hint'], $method->getReturnType()->getName()); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | ]; |
| 170 | 170 | |
| 171 | 171 | $reflectionMethods = []; |
| 172 | - foreach ($reflection->getMethods() as $method) { |
|
| 173 | - if ($method->getDeclaringClass()->name !== $reflection->name) { |
|
| 172 | + foreach ($reflection->getMethods() as $method){ |
|
| 173 | + if ($method->getDeclaringClass()->name !== $reflection->name){ |
|
| 174 | 174 | continue; |
| 175 | 175 | } |
| 176 | 176 | $reflectionMethods[$method->name] = $method; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | clearstatcache(); |
| 241 | 241 | |
| 242 | - $filename = $this->app->directory('config') . "$name.php"; |
|
| 242 | + $filename = $this->app->directory('config')."$name.php"; |
|
| 243 | 243 | $this->assertFileExists($filename); |
| 244 | 244 | |
| 245 | 245 | return $filename; |
@@ -115,17 +115,22 @@ discard block |
||
| 115 | 115 | ]; |
| 116 | 116 | |
| 117 | 117 | $reflectionMethods = []; |
| 118 | - foreach ($reflection->getMethods() as $method) { |
|
| 119 | - if ($method->getDeclaringClass()->name !== $reflection->name) { |
|
| 118 | + foreach ($reflection->getMethods() as $method) |
|
| 119 | + { |
|
| 120 | + if ($method->getDeclaringClass()->name !== $reflection->name) |
|
| 121 | + { |
|
| 120 | 122 | continue; |
| 121 | 123 | } |
| 122 | 124 | |
| 123 | 125 | $reflectionMethods[$method->name] = $method; |
| 124 | 126 | $this->assertArrayHasKey($method->name, $methods); |
| 125 | 127 | |
| 126 | - if (!$method->hasReturnType()) { |
|
| 128 | + if (!$method->hasReturnType()) |
|
| 129 | + { |
|
| 127 | 130 | $this->assertNull($methods[$method->name]['hint']); |
| 128 | - } else { |
|
| 131 | + } |
|
| 132 | + else |
|
| 133 | + { |
|
| 129 | 134 | $this->assertEquals($methods[$method->name]['hint'], $method->getReturnType()->getName()); |
| 130 | 135 | } |
| 131 | 136 | |
@@ -169,8 +174,10 @@ discard block |
||
| 169 | 174 | ]; |
| 170 | 175 | |
| 171 | 176 | $reflectionMethods = []; |
| 172 | - foreach ($reflection->getMethods() as $method) { |
|
| 173 | - if ($method->getDeclaringClass()->name !== $reflection->name) { |
|
| 177 | + foreach ($reflection->getMethods() as $method) |
|
| 178 | + { |
|
| 179 | + if ($method->getDeclaringClass()->name !== $reflection->name) |
|
| 180 | + { |
|
| 174 | 181 | continue; |
| 175 | 182 | } |
| 176 | 183 | $reflectionMethods[$method->name] = $method; |