@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | public function getDirectives(): array |
33 | 33 | { |
34 | 34 | $directives = []; |
35 | - foreach ($this->config['directives'] as $directive) { |
|
36 | - if (is_object($directive) && !$directive instanceof Autowire) { |
|
35 | + foreach ($this->config['directives'] as $directive){ |
|
36 | + if (is_object($directive) && !$directive instanceof Autowire){ |
|
37 | 37 | $directives[] = $directive; |
38 | 38 | continue; |
39 | 39 | } |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | public function getProcessors(): array |
51 | 51 | { |
52 | 52 | $processors = []; |
53 | - foreach ($this->config['processors'] as $processor) { |
|
54 | - if (is_object($processor) && !$processor instanceof Autowire) { |
|
53 | + foreach ($this->config['processors'] as $processor){ |
|
54 | + if (is_object($processor) && !$processor instanceof Autowire){ |
|
55 | 55 | $processors[] = $processor; |
56 | 56 | continue; |
57 | 57 | } |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | public function getVisitors(int $stage): array |
70 | 70 | { |
71 | 71 | $visitors = []; |
72 | - foreach ($this->config['visitors'][$stage] ?? [] as $visitor) { |
|
73 | - if (is_object($visitor) && !$visitor instanceof Autowire) { |
|
72 | + foreach ($this->config['visitors'][$stage] ?? [] as $visitor){ |
|
73 | + if (is_object($visitor) && !$visitor instanceof Autowire){ |
|
74 | 74 | $visitors[] = $visitor; |
75 | 75 | continue; |
76 | 76 | } |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | */ |
90 | 90 | private function wire($item): Autowire |
91 | 91 | { |
92 | - if ($item instanceof Autowire) { |
|
92 | + if ($item instanceof Autowire){ |
|
93 | 93 | return $item; |
94 | 94 | } |
95 | 95 | |
96 | - if (is_string($item)) { |
|
96 | + if (is_string($item)){ |
|
97 | 97 | return new Autowire($item); |
98 | 98 | } |
99 | 99 |
@@ -32,8 +32,10 @@ discard block |
||
32 | 32 | public function getDirectives(): array |
33 | 33 | { |
34 | 34 | $directives = []; |
35 | - foreach ($this->config['directives'] as $directive) { |
|
36 | - if (is_object($directive) && !$directive instanceof Autowire) { |
|
35 | + foreach ($this->config['directives'] as $directive) |
|
36 | + { |
|
37 | + if (is_object($directive) && !$directive instanceof Autowire) |
|
38 | + { |
|
37 | 39 | $directives[] = $directive; |
38 | 40 | continue; |
39 | 41 | } |
@@ -50,8 +52,10 @@ discard block |
||
50 | 52 | public function getProcessors(): array |
51 | 53 | { |
52 | 54 | $processors = []; |
53 | - foreach ($this->config['processors'] as $processor) { |
|
54 | - if (is_object($processor) && !$processor instanceof Autowire) { |
|
55 | + foreach ($this->config['processors'] as $processor) |
|
56 | + { |
|
57 | + if (is_object($processor) && !$processor instanceof Autowire) |
|
58 | + { |
|
55 | 59 | $processors[] = $processor; |
56 | 60 | continue; |
57 | 61 | } |
@@ -69,8 +73,10 @@ discard block |
||
69 | 73 | public function getVisitors(int $stage): array |
70 | 74 | { |
71 | 75 | $visitors = []; |
72 | - foreach ($this->config['visitors'][$stage] ?? [] as $visitor) { |
|
73 | - if (is_object($visitor) && !$visitor instanceof Autowire) { |
|
76 | + foreach ($this->config['visitors'][$stage] ?? [] as $visitor) |
|
77 | + { |
|
78 | + if (is_object($visitor) && !$visitor instanceof Autowire) |
|
79 | + { |
|
74 | 80 | $visitors[] = $visitor; |
75 | 81 | continue; |
76 | 82 | } |
@@ -89,11 +95,13 @@ discard block |
||
89 | 95 | */ |
90 | 96 | private function wire($item): Autowire |
91 | 97 | { |
92 | - if ($item instanceof Autowire) { |
|
98 | + if ($item instanceof Autowire) |
|
99 | + { |
|
93 | 100 | return $item; |
94 | 101 | } |
95 | 102 | |
96 | - if (is_string($item)) { |
|
103 | + if (is_string($item)) |
|
104 | + { |
|
97 | 105 | return new Autowire($item); |
98 | 106 | } |
99 | 107 |
@@ -67,15 +67,15 @@ discard block |
||
67 | 67 | public function isFresh(string $key): bool |
68 | 68 | { |
69 | 69 | $mapFilename = $this->mapFilename($key); |
70 | - if (!$this->files->exists($mapFilename)) { |
|
70 | + if (!$this->files->exists($mapFilename)){ |
|
71 | 71 | return false; |
72 | 72 | } |
73 | 73 | |
74 | 74 | $time = $this->files->time($this->filename($key)); |
75 | 75 | |
76 | 76 | $files = (array)include $mapFilename; |
77 | - foreach ($files as $file) { |
|
78 | - if ($this->files->time($file) > $time) { |
|
77 | + foreach ($files as $file){ |
|
78 | + if ($this->files->time($file) > $time){ |
|
79 | 79 | // some partial has changed |
80 | 80 | return false; |
81 | 81 | } |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | public function delete(string $key): void |
93 | 93 | { |
94 | 94 | $filename = $this->filename($key); |
95 | - if ($this->files->exists($filename)) { |
|
95 | + if ($this->files->exists($filename)){ |
|
96 | 96 | $this->files->delete($filename); |
97 | 97 | } |
98 | 98 | |
99 | 99 | $mapFilename = $this->mapFilename($key); |
100 | - if ($this->files->exists($mapFilename)) { |
|
100 | + if ($this->files->exists($mapFilename)){ |
|
101 | 101 | $this->files->delete($mapFilename); |
102 | 102 | } |
103 | 103 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | public function load(string $key): void |
111 | 111 | { |
112 | 112 | $filename = $this->filename($key); |
113 | - if ($this->files->exists($filename)) { |
|
113 | + if ($this->files->exists($filename)){ |
|
114 | 114 | include_once $filename; |
115 | 115 | } |
116 | 116 | } |
@@ -67,15 +67,18 @@ discard block |
||
67 | 67 | public function isFresh(string $key): bool |
68 | 68 | { |
69 | 69 | $mapFilename = $this->mapFilename($key); |
70 | - if (!$this->files->exists($mapFilename)) { |
|
70 | + if (!$this->files->exists($mapFilename)) |
|
71 | + { |
|
71 | 72 | return false; |
72 | 73 | } |
73 | 74 | |
74 | 75 | $time = $this->files->time($this->filename($key)); |
75 | 76 | |
76 | 77 | $files = (array)include $mapFilename; |
77 | - foreach ($files as $file) { |
|
78 | - if ($this->files->time($file) > $time) { |
|
78 | + foreach ($files as $file) |
|
79 | + { |
|
80 | + if ($this->files->time($file) > $time) |
|
81 | + { |
|
79 | 82 | // some partial has changed |
80 | 83 | return false; |
81 | 84 | } |
@@ -92,12 +95,14 @@ discard block |
||
92 | 95 | public function delete(string $key): void |
93 | 96 | { |
94 | 97 | $filename = $this->filename($key); |
95 | - if ($this->files->exists($filename)) { |
|
98 | + if ($this->files->exists($filename)) |
|
99 | + { |
|
96 | 100 | $this->files->delete($filename); |
97 | 101 | } |
98 | 102 | |
99 | 103 | $mapFilename = $this->mapFilename($key); |
100 | - if ($this->files->exists($mapFilename)) { |
|
104 | + if ($this->files->exists($mapFilename)) |
|
105 | + { |
|
101 | 106 | $this->files->delete($mapFilename); |
102 | 107 | } |
103 | 108 | } |
@@ -110,7 +115,8 @@ discard block |
||
110 | 115 | public function load(string $key): void |
111 | 116 | { |
112 | 117 | $filename = $this->filename($key); |
113 | - if ($this->files->exists($filename)) { |
|
118 | + if ($this->files->exists($filename)) |
|
119 | + { |
|
114 | 120 | include_once $filename; |
115 | 121 | } |
116 | 122 | } |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | { |
58 | 58 | $s = $this->getStempler(); |
59 | 59 | |
60 | - try { |
|
60 | + try{ |
|
61 | 61 | $s->get('echo', new ViewContext())->render(); |
62 | - } catch (RenderException $e) { |
|
62 | + }catch (RenderException $e){ |
|
63 | 63 | $t = $e->getUserTrace()[0]; |
64 | 64 | |
65 | 65 | $this->assertSame(2, $t['line']); |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | { |
72 | 72 | $s = $this->getStempler(); |
73 | 73 | |
74 | - try { |
|
74 | + try{ |
|
75 | 75 | $s->get('other:echo-in', new ViewContext())->render(); |
76 | - } catch (RenderException $e) { |
|
76 | + }catch (RenderException $e){ |
|
77 | 77 | $t = $e->getUserTrace(); |
78 | 78 | $this->assertCount(2, $t); |
79 | 79 | |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | { |
90 | 90 | $twig = $this->getStempler(); |
91 | 91 | |
92 | - try { |
|
92 | + try{ |
|
93 | 93 | $twig->get('other:bad', new ViewContext()); |
94 | - } catch (CompileException $e) { |
|
94 | + }catch (CompileException $e){ |
|
95 | 95 | $this->assertStringContainsString('bad.dark.php', $e->getFile()); |
96 | 96 | } |
97 | 97 | } |
@@ -57,9 +57,12 @@ discard block |
||
57 | 57 | { |
58 | 58 | $s = $this->getStempler(); |
59 | 59 | |
60 | - try { |
|
60 | + try |
|
61 | + { |
|
61 | 62 | $s->get('echo', new ViewContext())->render(); |
62 | - } catch (RenderException $e) { |
|
63 | + } |
|
64 | + catch (RenderException $e) |
|
65 | + { |
|
63 | 66 | $t = $e->getUserTrace()[0]; |
64 | 67 | |
65 | 68 | $this->assertSame(2, $t['line']); |
@@ -71,9 +74,12 @@ discard block |
||
71 | 74 | { |
72 | 75 | $s = $this->getStempler(); |
73 | 76 | |
74 | - try { |
|
77 | + try |
|
78 | + { |
|
75 | 79 | $s->get('other:echo-in', new ViewContext())->render(); |
76 | - } catch (RenderException $e) { |
|
80 | + } |
|
81 | + catch (RenderException $e) |
|
82 | + { |
|
77 | 83 | $t = $e->getUserTrace(); |
78 | 84 | $this->assertCount(2, $t); |
79 | 85 | |
@@ -89,9 +95,12 @@ discard block |
||
89 | 95 | { |
90 | 96 | $twig = $this->getStempler(); |
91 | 97 | |
92 | - try { |
|
98 | + try |
|
99 | + { |
|
93 | 100 | $twig->get('other:bad', new ViewContext()); |
94 | - } catch (CompileException $e) { |
|
101 | + } |
|
102 | + catch (CompileException $e) |
|
103 | + { |
|
95 | 104 | $this->assertStringContainsString('bad.dark.php', $e->getFile()); |
96 | 105 | } |
97 | 106 | } |
@@ -35,13 +35,13 @@ |
||
35 | 35 | |
36 | 36 | public function testCache(): void |
37 | 37 | { |
38 | - $this->assertCount(0, $this->files->getFiles(__DIR__ . '/cache/', '*.php')); |
|
38 | + $this->assertCount(0, $this->files->getFiles(__DIR__.'/cache/', '*.php')); |
|
39 | 39 | |
40 | 40 | $s = $this->getStempler(); |
41 | 41 | $this->assertSame('test', $s->get('test', new ViewContext())->render([])); |
42 | - $this->assertCount(2, $this->files->getFiles(__DIR__ . '/cache/', '*.php')); |
|
42 | + $this->assertCount(2, $this->files->getFiles(__DIR__.'/cache/', '*.php')); |
|
43 | 43 | |
44 | 44 | $s->reset('test', new ViewContext()); |
45 | - $this->assertCount(0, $this->files->getFiles(__DIR__ . '/../cache/', '*.php')); |
|
45 | + $this->assertCount(0, $this->files->getFiles(__DIR__.'/../cache/', '*.php')); |
|
46 | 46 | } |
47 | 47 | } |
@@ -3,12 +3,12 @@ |
||
3 | 3 | return [ |
4 | 4 | 'cache' => [ |
5 | 5 | 'enabled' => false, |
6 | - 'directory' => __DIR__ . '/../cache' |
|
6 | + 'directory' => __DIR__.'/../cache' |
|
7 | 7 | ], |
8 | 8 | 'namespaces' => [ |
9 | - 'default' => [__DIR__ . '/../fixtures/default'], |
|
10 | - 'other' => [__DIR__ . '/../fixtures/other'], |
|
11 | - 'extensions' => [__DIR__ . '/../fixtures/other/extensions'], |
|
9 | + 'default' => [__DIR__.'/../fixtures/default'], |
|
10 | + 'other' => [__DIR__.'/../fixtures/other'], |
|
11 | + 'extensions' => [__DIR__.'/../fixtures/other/extensions'], |
|
12 | 12 | ], |
13 | 13 | 'dependencies' => [], |
14 | 14 | 'engines' => [] |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | public function testBootloaderDirective(): void |
85 | 85 | { |
86 | - $this->container->bind('testBinding', function () { |
|
86 | + $this->container->bind('testBinding', function (){ |
|
87 | 87 | return 'test result'; |
88 | 88 | }); |
89 | 89 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | public function testBootloaderProcessors(): void |
103 | 103 | { |
104 | - $this->container->bind('testBinding', function () { |
|
104 | + $this->container->bind('testBinding', function (){ |
|
105 | 105 | return 'test result'; |
106 | 106 | }); |
107 | 107 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | public function testBootloaderVisitors(): void |
121 | 121 | { |
122 | - $this->container->bind('testBinding', function () { |
|
122 | + $this->container->bind('testBinding', function (){ |
|
123 | 123 | return 'test result'; |
124 | 124 | }); |
125 | 125 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | public function testBootloaderVisitors0(): void |
139 | 139 | { |
140 | - $this->container->bind('testBinding', function () { |
|
140 | + $this->container->bind('testBinding', function (){ |
|
141 | 141 | return 'test result'; |
142 | 142 | }); |
143 | 143 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | public function testBootloaderVisitors2(): void |
157 | 157 | { |
158 | - $this->container->bind('testBinding', function () { |
|
158 | + $this->container->bind('testBinding', function (){ |
|
159 | 159 | return 'test result'; |
160 | 160 | }); |
161 | 161 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | public function testBootloaderVisitors3(): void |
175 | 175 | { |
176 | - $this->container->bind('testBinding', function () { |
|
176 | + $this->container->bind('testBinding', function (){ |
|
177 | 177 | return 'test result'; |
178 | 178 | }); |
179 | 179 |
@@ -83,7 +83,8 @@ discard block |
||
83 | 83 | |
84 | 84 | public function testBootloaderDirective(): void |
85 | 85 | { |
86 | - $this->container->bind('testBinding', function () { |
|
86 | + $this->container->bind('testBinding', function () |
|
87 | + { |
|
87 | 88 | return 'test result'; |
88 | 89 | }); |
89 | 90 | |
@@ -101,7 +102,8 @@ discard block |
||
101 | 102 | |
102 | 103 | public function testBootloaderProcessors(): void |
103 | 104 | { |
104 | - $this->container->bind('testBinding', function () { |
|
105 | + $this->container->bind('testBinding', function () |
|
106 | + { |
|
105 | 107 | return 'test result'; |
106 | 108 | }); |
107 | 109 | |
@@ -119,7 +121,8 @@ discard block |
||
119 | 121 | |
120 | 122 | public function testBootloaderVisitors(): void |
121 | 123 | { |
122 | - $this->container->bind('testBinding', function () { |
|
124 | + $this->container->bind('testBinding', function () |
|
125 | + { |
|
123 | 126 | return 'test result'; |
124 | 127 | }); |
125 | 128 | |
@@ -137,7 +140,8 @@ discard block |
||
137 | 140 | |
138 | 141 | public function testBootloaderVisitors0(): void |
139 | 142 | { |
140 | - $this->container->bind('testBinding', function () { |
|
143 | + $this->container->bind('testBinding', function () |
|
144 | + { |
|
141 | 145 | return 'test result'; |
142 | 146 | }); |
143 | 147 | |
@@ -155,7 +159,8 @@ discard block |
||
155 | 159 | |
156 | 160 | public function testBootloaderVisitors2(): void |
157 | 161 | { |
158 | - $this->container->bind('testBinding', function () { |
|
162 | + $this->container->bind('testBinding', function () |
|
163 | + { |
|
159 | 164 | return 'test result'; |
160 | 165 | }); |
161 | 166 | |
@@ -173,7 +178,8 @@ discard block |
||
173 | 178 | |
174 | 179 | public function testBootloaderVisitors3(): void |
175 | 180 | { |
176 | - $this->container->bind('testBinding', function () { |
|
181 | + $this->container->bind('testBinding', function () |
|
182 | + { |
|
177 | 183 | return 'test result'; |
178 | 184 | }); |
179 | 185 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | |
34 | 34 | $this->assertNotEmpty($logger); |
35 | 35 | $this->assertSame($logger, $factory->getLogger()); |
36 | - $this->assertSame($logger, $factory->getLogger(LogFactory::DEFAULT)); |
|
36 | + $this->assertSame($logger, $factory->getLogger(LogFactory::default)); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function testInjection(): void |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | $container = new Container(); |
54 | 54 | $container->bind(ConfiguratorInterface::class, new ConfigManager( |
55 | - new class() implements LoaderInterface { |
|
55 | + new class() implements LoaderInterface{ |
|
56 | 56 | public function has(string $section): bool |
57 | 57 | { |
58 | 58 | return false; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | $container = new Container(); |
81 | 81 | $container->bind(ConfiguratorInterface::class, new ConfigManager( |
82 | - new class() implements LoaderInterface { |
|
82 | + new class() implements LoaderInterface{ |
|
83 | 83 | public function has(string $section): bool |
84 | 84 | { |
85 | 85 | return false; |
@@ -52,7 +52,8 @@ discard block |
||
52 | 52 | |
53 | 53 | $container = new Container(); |
54 | 54 | $container->bind(ConfiguratorInterface::class, new ConfigManager( |
55 | - new class() implements LoaderInterface { |
|
55 | + new class() implements LoaderInterface |
|
56 | + { |
|
56 | 57 | public function has(string $section): bool |
57 | 58 | { |
58 | 59 | return false; |
@@ -79,7 +80,8 @@ discard block |
||
79 | 80 | { |
80 | 81 | $container = new Container(); |
81 | 82 | $container->bind(ConfiguratorInterface::class, new ConfigManager( |
82 | - new class() implements LoaderInterface { |
|
83 | + new class() implements LoaderInterface |
|
84 | + { |
|
83 | 85 | public function has(string $section): bool |
84 | 86 | { |
85 | 87 | return false; |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public function testNotFound() |
20 | 20 | { |
21 | 21 | $e = new Environment(); |
22 | - $d = new Directories(['root' => __DIR__ . '/..']); |
|
22 | + $d = new Directories(['root' => __DIR__.'/..']); |
|
23 | 23 | |
24 | 24 | $b = new DotenvBootloader(); |
25 | 25 | $b->boot($d, $e); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function testFoundCustom() |
42 | 42 | { |
43 | 43 | $e = new Environment([ |
44 | - 'DOTENV_PATH' => __DIR__ . '/.env.custom' |
|
44 | + 'DOTENV_PATH' => __DIR__.'/.env.custom' |
|
45 | 45 | ]); |
46 | 46 | |
47 | 47 | $d = new Directories(['root' => __DIR__]); |
@@ -41,7 +41,7 @@ |
||
41 | 41 | { |
42 | 42 | $permission = $this->permissions->getPermission($controller, $action); |
43 | 43 | |
44 | - if ($permission->ok && !$this->guard->allows($permission->permission, $parameters)) { |
|
44 | + if ($permission->ok && !$this->guard->allows($permission->permission, $parameters)){ |
|
45 | 45 | throw new ControllerException($permission->message, $permission->code); |
46 | 46 | } |
47 | 47 |
@@ -41,7 +41,8 @@ |
||
41 | 41 | { |
42 | 42 | $permission = $this->permissions->getPermission($controller, $action); |
43 | 43 | |
44 | - if ($permission->ok && !$this->guard->allows($permission->permission, $parameters)) { |
|
44 | + if ($permission->ok && !$this->guard->allows($permission->permission, $parameters)) |
|
45 | + { |
|
45 | 46 | throw new ControllerException($permission->message, $permission->code); |
46 | 47 | } |
47 | 48 |