@@ -43,9 +43,12 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $http->setHandler( |
| 45 | 45 | static function (ServerRequestInterface $request, ResponseInterface $response): void { |
| 46 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
| 46 | + if ($request->getAttribute('authContext')->getToken() === null) |
|
| 47 | + { |
|
| 47 | 48 | echo 'no token'; |
| 48 | - } else { |
|
| 49 | + } |
|
| 50 | + else |
|
| 51 | + { |
|
| 49 | 52 | echo $request->getAttribute('authContext')->getToken()->getID(); |
| 50 | 53 | echo ':'; |
| 51 | 54 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -67,9 +70,12 @@ discard block |
||
| 67 | 70 | |
| 68 | 71 | $http->setHandler( |
| 69 | 72 | static function (ServerRequestInterface $request, ResponseInterface $response): void { |
| 70 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
| 73 | + if ($request->getAttribute('authContext')->getToken() === null) |
|
| 74 | + { |
|
| 71 | 75 | echo 'no token'; |
| 72 | - } else { |
|
| 76 | + } |
|
| 77 | + else |
|
| 78 | + { |
|
| 73 | 79 | echo $request->getAttribute('authContext')->getToken()->getID(); |
| 74 | 80 | echo ':'; |
| 75 | 81 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $http->setHandler( |
| 30 | 30 | static function (ServerRequestInterface $request, ResponseInterface $response): void { |
| 31 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
| 31 | + if ($request->getAttribute('authContext')->getToken() === null){ |
|
| 32 | 32 | echo 'no token'; |
| 33 | - } else { |
|
| 33 | + }else{ |
|
| 34 | 34 | echo $request->getAttribute('authContext')->getToken()->getID(); |
| 35 | 35 | echo ':'; |
| 36 | 36 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | ); |
| 44 | 44 | |
| 45 | 45 | self::assertSame(['text/html; charset=UTF-8'], $response->getHeader('Content-Type')); |
| 46 | - self::assertSame('good-token:{"id":"good-token"}', (string) $response->getBody()); |
|
| 46 | + self::assertSame('good-token:{"id":"good-token"}', (string)$response->getBody()); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | public function testBadCookieToken(): void |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $http->setHandler( |
| 54 | 54 | static function (ServerRequestInterface $request, ResponseInterface $response): void { |
| 55 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
| 55 | + if ($request->getAttribute('authContext')->getToken() === null){ |
|
| 56 | 56 | echo 'no token'; |
| 57 | - } else { |
|
| 57 | + }else{ |
|
| 58 | 58 | echo $request->getAttribute('authContext')->getToken()->getID(); |
| 59 | 59 | echo ':'; |
| 60 | 60 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | ); |
| 68 | 68 | |
| 69 | 69 | self::assertSame(['text/html; charset=UTF-8'], $response->getHeader('Content-Type')); |
| 70 | - self::assertSame('no token', (string) $response->getBody()); |
|
| 70 | + self::assertSame('no token', (string)$response->getBody()); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | public function testDeleteToken(): void |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | 89 | self::assertSame(['auth-token=; Path=/; HttpOnly'], $response->getHeader('Set-Cookie')); |
| 90 | - self::assertSame('closed', (string) $response->getBody()); |
|
| 90 | + self::assertSame('closed', (string)$response->getBody()); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public function testCommitToken(): void |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | ); |
| 152 | 152 | |
| 153 | 153 | self::assertSame( |
| 154 | - 'Expires=' . gmdate(DATE_COOKIE, time() + 3600), |
|
| 154 | + 'Expires='.gmdate(DATE_COOKIE, time() + 3600), |
|
| 155 | 155 | $cookie[1], |
| 156 | 156 | ); |
| 157 | 157 | |
@@ -27,12 +27,15 @@ |
||
| 27 | 27 | $functionA = null; |
| 28 | 28 | $functionB = null; |
| 29 | 29 | |
| 30 | - foreach ($reflection->getInvocations() as $invocation) { |
|
| 31 | - if ($invocation->getName() == 'test_function_a') { |
|
| 30 | + foreach ($reflection->getInvocations() as $invocation) |
|
| 31 | + { |
|
| 32 | + if ($invocation->getName() == 'test_function_a') |
|
| 33 | + { |
|
| 32 | 34 | $functionA = $invocation; |
| 33 | 35 | } |
| 34 | 36 | |
| 35 | - if ($invocation->getName() == 'test_function_b') { |
|
| 37 | + if ($invocation->getName() == 'test_function_b') |
|
| 38 | + { |
|
| 36 | 39 | $functionB = $invocation; |
| 37 | 40 | } |
| 38 | 41 | } |
@@ -16,17 +16,17 @@ discard block |
||
| 16 | 16 | self::assertContains(TestTrait::class, $reflection->getTraits()); |
| 17 | 17 | self::assertContains(TestInterface::class, $reflection->getInterfaces()); |
| 18 | 18 | |
| 19 | - self::assertSame([__NAMESPACE__ . '\hello'], $reflection->getFunctions()); |
|
| 19 | + self::assertSame([__NAMESPACE__.'\hello'], $reflection->getFunctions()); |
|
| 20 | 20 | |
| 21 | 21 | $functionA = null; |
| 22 | 22 | $functionB = null; |
| 23 | 23 | |
| 24 | - foreach ($reflection->getInvocations() as $invocation) { |
|
| 25 | - if ($invocation->getName() == 'test_function_a') { |
|
| 24 | + foreach ($reflection->getInvocations() as $invocation){ |
|
| 25 | + if ($invocation->getName() == 'test_function_a'){ |
|
| 26 | 26 | $functionA = $invocation; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - if ($invocation->getName() == 'test_function_b') { |
|
| 29 | + if ($invocation->getName() == 'test_function_b'){ |
|
| 30 | 30 | $functionB = $invocation; |
| 31 | 31 | } |
| 32 | 32 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | public function testReflectionFileWithNamedParameters(): void |
| 55 | 55 | { |
| 56 | - $reflection = new ReflectionFile(__DIR__ . '/Classes/ClassWithNamedParameter.php'); |
|
| 56 | + $reflection = new ReflectionFile(__DIR__.'/Classes/ClassWithNamedParameter.php'); |
|
| 57 | 57 | |
| 58 | 58 | self::assertSame([ |
| 59 | 59 | \Spiral\Tests\Tokenizer\Classes\ClassWithNamedParameter::class, |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | public function testReflectionFileAnonymousClass(): void |
| 64 | 64 | { |
| 65 | - $reflection = new ReflectionFile(__DIR__ . '/Classes/ClassWithAnonymousClass.php'); |
|
| 65 | + $reflection = new ReflectionFile(__DIR__.'/Classes/ClassWithAnonymousClass.php'); |
|
| 66 | 66 | |
| 67 | 67 | self::assertSame([ |
| 68 | 68 | \Spiral\Tests\Tokenizer\Classes\ClassWithAnonymousClass::class, |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public function testReflectionFileWithHeredoc(): void |
| 73 | 73 | { |
| 74 | - $reflection = new ReflectionFile(__DIR__ . '/Classes/ClassWithHeredoc.php'); |
|
| 74 | + $reflection = new ReflectionFile(__DIR__.'/Classes/ClassWithHeredoc.php'); |
|
| 75 | 75 | |
| 76 | 76 | self::assertSame([ |
| 77 | 77 | 'Spiral\Tests\Tokenizer\Classes\ClassWithHeredoc', |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | public function testReflectionEnum(): void |
| 82 | 82 | { |
| 83 | - $reflection = new ReflectionFile(__DIR__ . '/Classes/ClassD.php'); |
|
| 83 | + $reflection = new ReflectionFile(__DIR__.'/Classes/ClassD.php'); |
|
| 84 | 84 | |
| 85 | 85 | self::assertSame([ |
| 86 | 86 | \Spiral\Tests\Tokenizer\Classes\ClassD::class, |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | public function testReflectionTypedEnum(): void |
| 91 | 91 | { |
| 92 | - $reflection = new ReflectionFile(__DIR__ . '/Classes/ClassE.php'); |
|
| 92 | + $reflection = new ReflectionFile(__DIR__.'/Classes/ClassE.php'); |
|
| 93 | 93 | |
| 94 | 94 | self::assertSame([ |
| 95 | 95 | \Spiral\Tests\Tokenizer\Classes\ClassE::class, |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | public function testReflectionInterface(): void |
| 100 | 100 | { |
| 101 | - $reflection = new ReflectionFile(__DIR__ . '/Interfaces/InterfaceA.php'); |
|
| 101 | + $reflection = new ReflectionFile(__DIR__.'/Interfaces/InterfaceA.php'); |
|
| 102 | 102 | |
| 103 | 103 | self::assertSame([ |
| 104 | 104 | \Spiral\Tests\Tokenizer\Interfaces\InterfaceA::class, |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | $container = new Container(); |
| 78 | 78 | $container->bind(TranslatorConfig::class, new TranslatorConfig([ |
| 79 | 79 | 'locale' => 'en', |
| 80 | - 'directory' => __DIR__ . '/fixtures/locales/', |
|
| 80 | + 'directory' => __DIR__.'/fixtures/locales/', |
|
| 81 | 81 | 'loaders' => [ |
| 82 | 82 | 'php' => PhpFileLoader::class, |
| 83 | 83 | 'po' => PoFileLoader::class, |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | |
| 45 | 45 | $this->container->bind(TranslatorConfig::class, new TranslatorConfig([ |
| 46 | 46 | 'locale' => 'en', |
| 47 | - 'directory' => __DIR__ . '/fixtures/locales/', |
|
| 47 | + 'directory' => __DIR__.'/fixtures/locales/', |
|
| 48 | 48 | 'loaders' => [ |
| 49 | 49 | 'php' => PhpFileLoader::class, |
| 50 | 50 | 'po' => PoFileLoader::class, |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | $this->expectException(LoaderException::class); |
| 25 | 25 | |
| 26 | 26 | $loader = new ViewLoader([ |
| 27 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 27 | + 'default' => __DIR__.'/fixtures/default', |
|
| 28 | 28 | ]); |
| 29 | 29 | |
| 30 | 30 | $loader->exists('view'); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $this->expectException(LoaderException::class); |
| 36 | 36 | |
| 37 | 37 | $loader = new ViewLoader([ |
| 38 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 38 | + 'default' => __DIR__.'/fixtures/default', |
|
| 39 | 39 | ]); |
| 40 | 40 | |
| 41 | 41 | $loader->list(); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $this->expectException(LoaderException::class); |
| 47 | 47 | |
| 48 | 48 | $loader = new ViewLoader([ |
| 49 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 49 | + 'default' => __DIR__.'/fixtures/default', |
|
| 50 | 50 | ]); |
| 51 | 51 | |
| 52 | 52 | $loader->load('view'); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | public function testExists(): void |
| 56 | 56 | { |
| 57 | 57 | $loader = new ViewLoader([ |
| 58 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 58 | + 'default' => __DIR__.'/fixtures/default', |
|
| 59 | 59 | ]); |
| 60 | 60 | |
| 61 | 61 | $loader = $loader->withExtension('php'); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | public function testList(): void |
| 87 | 87 | { |
| 88 | 88 | $loader = new ViewLoader([ |
| 89 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 89 | + 'default' => __DIR__.'/fixtures/default', |
|
| 90 | 90 | ]); |
| 91 | 91 | |
| 92 | 92 | $loader = $loader->withExtension('php'); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $this->expectException(LoaderException::class); |
| 104 | 104 | |
| 105 | 105 | $loader = new ViewLoader([ |
| 106 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 106 | + 'default' => __DIR__.'/fixtures/default', |
|
| 107 | 107 | ]); |
| 108 | 108 | |
| 109 | 109 | $loader = $loader->withExtension('php'); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | public function testLoad(): void |
| 147 | 147 | { |
| 148 | 148 | $loader = new ViewLoader([ |
| 149 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 149 | + 'default' => __DIR__.'/fixtures/default', |
|
| 150 | 150 | ]); |
| 151 | 151 | |
| 152 | 152 | $loader = $loader->withExtension('php'); |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | public function testMultipleNamespaces(): void |
| 170 | 170 | { |
| 171 | 171 | $loader = new ViewLoader([ |
| 172 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 173 | - 'other' => __DIR__ . '/fixtures/other', |
|
| 172 | + 'default' => __DIR__.'/fixtures/default', |
|
| 173 | + 'other' => __DIR__.'/fixtures/other', |
|
| 174 | 174 | |
| 175 | 175 | ]); |
| 176 | 176 | |
@@ -36,7 +36,8 @@ |
||
| 36 | 36 | $manager->addEngine(new NativeEngine($this->container, 'dark.php')); |
| 37 | 37 | |
| 38 | 38 | $ext = []; |
| 39 | - foreach ($manager->getEngines() as $e) { |
|
| 39 | + foreach ($manager->getEngines() as $e) |
|
| 40 | + { |
|
| 40 | 41 | $ext[] = $e->getLoader()->getExtension(); |
| 41 | 42 | } |
| 42 | 43 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $manager->addEngine(new NativeEngine($this->container, 'dark.php')); |
| 28 | 28 | |
| 29 | 29 | $ext = []; |
| 30 | - foreach ($manager->getEngines() as $e) { |
|
| 30 | + foreach ($manager->getEngines() as $e){ |
|
| 31 | 31 | $ext[] = $e->getLoader()->getExtension(); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | 'directory' => '/tmp', |
| 123 | 123 | ], |
| 124 | 124 | 'namespaces' => [ |
| 125 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 126 | - 'other' => __DIR__ . '/fixtures/other', |
|
| 125 | + 'default' => __DIR__.'/fixtures/default', |
|
| 126 | + 'other' => __DIR__.'/fixtures/other', |
|
| 127 | 127 | ], |
| 128 | 128 | 'dependencies' => [ |
| 129 | 129 | |
@@ -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 | |
@@ -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 | |