Passed
Pull Request — master (#228)
by Valentin
02:47
created
tests/app/src/Bootloader/AppBootloader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
             new Route('/auth/<action>', new Controller(AuthController::class))
50 50
         );
51 51
 
52
-        $views->addDirectory('custom', __DIR__ . '/../../views/custom/');
52
+        $views->addDirectory('custom', __DIR__.'/../../views/custom/');
53 53
         $views->addEngine(TestEngine::class);
54 54
 
55 55
         $validation->addAlias('aliased', 'notEmpty');
Please login to merge, or discard this patch.
src/Auth/Cycle/Token.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
         array $payload,
51 51
         \DateTimeImmutable $createdAt,
52 52
         \DateTimeInterface $expiresAt = null
53
-    ) {
53
+    ){
54 54
         $this->id = $id;
55 55
 
56 56
         $this->secretValue = $secretValue;
Please login to merge, or discard this patch.
src/Command/Cycle/SyncCommand.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 
44 44
         $memory->saveData('cycle', $schema);
45 45
 
46
-        if ($show->hasChanges()) {
46
+        if ($show->hasChanges()){
47 47
             $this->writeln("\n<info>ORM Schema has been synchronized</info>");
48 48
         }
49 49
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,8 @@
 block discarded – undo
43 43
 
44 44
         $memory->saveData('cycle', $schema);
45 45
 
46
-        if ($show->hasChanges()) {
46
+        if ($show->hasChanges())
47
+        {
47 48
             $this->writeln("\n<info>ORM Schema has been synchronized</info>");
48 49
         }
49 50
     }
Please login to merge, or discard this patch.
src/Bootloader/Cycle/SchemaBootloader.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
     public function getGenerators(): array
86 86
     {
87 87
         $result = [];
88
-        foreach ($this->generators as $group) {
89
-            foreach ($group as $generator) {
90
-                if (is_object($generator) && !$generator instanceof Container\Autowire) {
88
+        foreach ($this->generators as $group){
89
+            foreach ($group as $generator){
90
+                if (is_object($generator) && !$generator instanceof Container\Autowire){
91 91
                     $result[] = $generator;
92
-                } else {
92
+                }else{
93 93
                     $result[] = $this->container->get($generator);
94 94
                 }
95 95
             }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     protected function schema(MemoryInterface $memory): SchemaInterface
106 106
     {
107 107
         $schema = $memory->loadData('cycle');
108
-        if (is_null($schema)) {
108
+        if (is_null($schema)){
109 109
             $schema = (new Compiler())->compile(
110 110
                 $this->container->get(Registry::class),
111 111
                 $this->getGenerators()
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,11 +85,16 @@  discard block
 block discarded – undo
85 85
     public function getGenerators(): array
86 86
     {
87 87
         $result = [];
88
-        foreach ($this->generators as $group) {
89
-            foreach ($group as $generator) {
90
-                if (is_object($generator) && !$generator instanceof Container\Autowire) {
88
+        foreach ($this->generators as $group)
89
+        {
90
+            foreach ($group as $generator)
91
+            {
92
+                if (is_object($generator) && !$generator instanceof Container\Autowire)
93
+                {
91 94
                     $result[] = $generator;
92
-                } else {
95
+                }
96
+                else
97
+                {
93 98
                     $result[] = $this->container->get($generator);
94 99
                 }
95 100
             }
@@ -105,7 +110,8 @@  discard block
 block discarded – undo
105 110
     protected function schema(MemoryInterface $memory): SchemaInterface
106 111
     {
107 112
         $schema = $memory->loadData('cycle');
108
-        if (is_null($schema)) {
113
+        if (is_null($schema))
114
+        {
109 115
             $schema = (new Compiler())->compile(
110 116
                 $this->container->get(Registry::class),
111 117
                 $this->getGenerators()
Please login to merge, or discard this patch.
src/Bootloader/Cycle/CycleBootloader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     public function boot(Container $container, FinalizerInterface $finalizer): void
53 53
     {
54 54
         $finalizer->addFinalizer(function () use ($container): void {
55
-            if ($container->hasInstance(ORMInterface::class)) {
55
+            if ($container->hasInstance(ORMInterface::class)){
56 56
                 $container->get(ORMInterface::class)->getHeap()->clean();
57 57
             }
58 58
         });
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     ): ORMInterface {
74 74
         $orm = new ORM($factory, $schema);
75 75
 
76
-        if ($promiseFactory !== null) {
76
+        if ($promiseFactory !== null){
77 77
             return $orm->withPromiseFactory($promiseFactory);
78 78
         }
79 79
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,8 @@  discard block
 block discarded – undo
52 52
     public function boot(Container $container, FinalizerInterface $finalizer): void
53 53
     {
54 54
         $finalizer->addFinalizer(function () use ($container): void {
55
-            if ($container->hasInstance(ORMInterface::class)) {
55
+            if ($container->hasInstance(ORMInterface::class))
56
+            {
56 57
                 $container->get(ORMInterface::class)->getHeap()->clean();
57 58
             }
58 59
         });
@@ -73,7 +74,8 @@  discard block
 block discarded – undo
73 74
     ): ORMInterface {
74 75
         $orm = new ORM($factory, $schema);
75 76
 
76
-        if ($promiseFactory !== null) {
77
+        if ($promiseFactory !== null)
78
+        {
77 79
             return $orm->withPromiseFactory($promiseFactory);
78 80
         }
79 81
 
Please login to merge, or discard this patch.
src/Cycle/RepositoryInjector.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@
 block discarded – undo
38 38
     public function createInjection(\ReflectionClass $class, string $context = null)
39 39
     {
40 40
         $schema = $this->orm->getSchema();
41
-        foreach ($schema->getRoles() as $role) {
41
+        foreach ($schema->getRoles() as $role){
42 42
             $repository = $schema->define($role, Schema::REPOSITORY);
43
-            if ($repository !== Select\Repository::class && $repository === $class->getName()) {
43
+            if ($repository !== Select\Repository::class && $repository === $class->getName()){
44 44
                 return $this->orm->getRepository($role);
45 45
             }
46 46
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,9 +38,11 @@
 block discarded – undo
38 38
     public function createInjection(\ReflectionClass $class, string $context = null)
39 39
     {
40 40
         $schema = $this->orm->getSchema();
41
-        foreach ($schema->getRoles() as $role) {
41
+        foreach ($schema->getRoles() as $role)
42
+        {
42 43
             $repository = $schema->define($role, Schema::REPOSITORY);
43
-            if ($repository !== Select\Repository::class && $repository === $class->getName()) {
44
+            if ($repository !== Select\Repository::class && $repository === $class->getName())
45
+            {
44 46
                 return $this->orm->getRepository($role);
45 47
             }
46 48
         }
Please login to merge, or discard this patch.
src/Http/Middleware/JsonPayloadMiddleware.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@
 block discarded – undo
29 29
      */
30 30
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
31 31
     {
32
-        if ($this->isJsonPayload($request)) {
32
+        if ($this->isJsonPayload($request)){
33 33
             $request = $request->withParsedBody(json_decode((string)$request->getBody(), true));
34
-            if (json_last_error() !== 0) {
34
+            if (json_last_error() !== 0){
35 35
                 throw new ClientException(400, 'invalid json payload');
36 36
             }
37 37
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,9 +29,11 @@
 block discarded – undo
29 29
      */
30 30
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
31 31
     {
32
-        if ($this->isJsonPayload($request)) {
32
+        if ($this->isJsonPayload($request))
33
+        {
33 34
             $request = $request->withParsedBody(json_decode((string)$request->getBody(), true));
34
-            if (json_last_error() !== 0) {
35
+            if (json_last_error() !== 0)
36
+            {
35 37
                 throw new ClientException(400, 'invalid json payload');
36 38
             }
37 39
         }
Please login to merge, or discard this patch.
tests/app/src/Controller/TestController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 
49 49
     public function input(InputScope $i)
50 50
     {
51
-        return 'value: ' . $i->withPrefix('section')->getValue('query', 'value');
51
+        return 'value: '.$i->withPrefix('section')->getValue('query', 'value');
52 52
     }
53 53
 
54 54
     public function error(): void
Please login to merge, or discard this patch.
src/Auth/Cycle/TokenStorage.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function load(string $id): ?TokenInterface
45 45
     {
46
-        if (strpos($id, ':') === false) {
46
+        if (strpos($id, ':') === false){
47 47
             return null;
48 48
         }
49 49
 
@@ -52,14 +52,14 @@  discard block
 block discarded – undo
52 52
         /** @var Token $token */
53 53
         $token = $this->orm->getRepository(Token::class)->findByPK($pk);
54 54
 
55
-        if ($token === null || !hash_equals($token->getHashedValue(), hash('sha512', $hash))) {
55
+        if ($token === null || !hash_equals($token->getHashedValue(), hash('sha512', $hash))){
56 56
             // hijacked or deleted
57 57
             return null;
58 58
         }
59 59
 
60 60
         $token->setSecretValue($hash);
61 61
 
62
-        if ($token->getExpiresAt() !== null && $token->getExpiresAt() < new \DateTime()) {
62
+        if ($token->getExpiresAt() !== null && $token->getExpiresAt() < new \DateTime()){
63 63
             $this->delete($token);
64 64
             return null;
65 65
         }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function create(array $payload, \DateTimeInterface $expiresAt = null): TokenInterface
74 74
     {
75
-        try {
75
+        try{
76 76
             $token = new Token(
77 77
                 $this->issueID(),
78 78
                 $this->randomHash(128),
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             $this->em->persist($token)->run();
85 85
 
86 86
             return $token;
87
-        } catch (\Throwable $e) {
87
+        }catch (\Throwable $e){
88 88
             throw new TokenStorageException('Unable to create token', $e->getCode(), $e);
89 89
         }
90 90
     }
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function delete(TokenInterface $token): void
96 96
     {
97
-        try {
97
+        try{
98 98
             $this->em->delete($token)->run();
99
-        } catch (\Throwable $e) {
99
+        }catch (\Throwable $e){
100 100
             throw new TokenStorageException('Unable to delete token', $e->getCode(), $e);
101 101
         }
102 102
     }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             $this->orm->getSource(Token::class)->getTable()
116 116
         );
117 117
 
118
-        while ((clone $query)->where('id', $id)->count('id') !== 0) {
118
+        while ((clone $query)->where('id', $id)->count('id') !== 0){
119 119
             $id = $this->randomHash(64);
120 120
         }
121 121
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,7 +43,8 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function load(string $id): ?TokenInterface
45 45
     {
46
-        if (strpos($id, ':') === false) {
46
+        if (strpos($id, ':') === false)
47
+        {
47 48
             return null;
48 49
         }
49 50
 
@@ -52,14 +53,16 @@  discard block
 block discarded – undo
52 53
         /** @var Token $token */
53 54
         $token = $this->orm->getRepository(Token::class)->findByPK($pk);
54 55
 
55
-        if ($token === null || !hash_equals($token->getHashedValue(), hash('sha512', $hash))) {
56
+        if ($token === null || !hash_equals($token->getHashedValue(), hash('sha512', $hash)))
57
+        {
56 58
             // hijacked or deleted
57 59
             return null;
58 60
         }
59 61
 
60 62
         $token->setSecretValue($hash);
61 63
 
62
-        if ($token->getExpiresAt() !== null && $token->getExpiresAt() < new \DateTime()) {
64
+        if ($token->getExpiresAt() !== null && $token->getExpiresAt() < new \DateTime())
65
+        {
63 66
             $this->delete($token);
64 67
             return null;
65 68
         }
@@ -72,7 +75,8 @@  discard block
 block discarded – undo
72 75
      */
73 76
     public function create(array $payload, \DateTimeInterface $expiresAt = null): TokenInterface
74 77
     {
75
-        try {
78
+        try
79
+        {
76 80
             $token = new Token(
77 81
                 $this->issueID(),
78 82
                 $this->randomHash(128),
@@ -84,7 +88,9 @@  discard block
 block discarded – undo
84 88
             $this->em->persist($token)->run();
85 89
 
86 90
             return $token;
87
-        } catch (\Throwable $e) {
91
+        }
92
+        catch (\Throwable $e)
93
+        {
88 94
             throw new TokenStorageException('Unable to create token', $e->getCode(), $e);
89 95
         }
90 96
     }
@@ -94,9 +100,12 @@  discard block
 block discarded – undo
94 100
      */
95 101
     public function delete(TokenInterface $token): void
96 102
     {
97
-        try {
103
+        try
104
+        {
98 105
             $this->em->delete($token)->run();
99
-        } catch (\Throwable $e) {
106
+        }
107
+        catch (\Throwable $e)
108
+        {
100 109
             throw new TokenStorageException('Unable to delete token', $e->getCode(), $e);
101 110
         }
102 111
     }
@@ -115,7 +124,8 @@  discard block
 block discarded – undo
115 124
             $this->orm->getSource(Token::class)->getTable()
116 125
         );
117 126
 
118
-        while ((clone $query)->where('id', $id)->count('id') !== 0) {
127
+        while ((clone $query)->where('id', $id)->count('id') !== 0)
128
+        {
119 129
             $id = $this->randomHash(64);
120 130
         }
121 131
 
Please login to merge, or discard this patch.