Passed
Push — master ( 2291e3...cd7158 )
by Anton
03:34
created
src/Framework/Bootloader/SnapshotsBootloader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,9 +46,9 @@
 block discarded – undo
46 46
         DirectoriesInterface $dirs,
47 47
         FilesInterface $files,
48 48
         LoggerInterface $logger = null
49
-    ) {
49
+    ){
50 50
         return new FileSnapshooter(
51
-            $dirs->get('runtime') . '/snapshots/',
51
+            $dirs->get('runtime').'/snapshots/',
52 52
             $env->get('SNAPSHOT_MAX_FILES', self::MAX_SNAPSHOTS),
53 53
             $env->get('SNAPSHOT_VERBOSITY', HandlerInterface::VERBOSITY_VERBOSE),
54 54
             new PlainHandler(),
Please login to merge, or discard this patch.
src/Framework/Bootloader/Auth/SecurityActorBootloader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
     private function actor(AuthContextInterface $context): ActorInterface
39 39
     {
40 40
         $actor = $context->getActor();
41
-        if ($actor instanceof ActorInterface) {
41
+        if ($actor instanceof ActorInterface){
42 42
             return $actor;
43 43
         }
44 44
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,8 @@
 block discarded – undo
38 38
     private function actor(AuthContextInterface $context): ActorInterface
39 39
     {
40 40
         $actor = $context->getActor();
41
-        if ($actor instanceof ActorInterface) {
41
+        if ($actor instanceof ActorInterface)
42
+        {
42 43
             return $actor;
43 44
         }
44 45
 
Please login to merge, or discard this patch.
src/Framework/Bootloader/Auth/HttpAuthBootloader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,8 +87,8 @@
 block discarded – undo
87 87
         $registry = new TransportRegistry();
88 88
         $registry->setDefaultTransport($config->getDefaultTransport());
89 89
 
90
-        foreach ($config->getTransports() as $name => $transport) {
91
-            if ($transport instanceof Autowire) {
90
+        foreach ($config->getTransports() as $name => $transport){
91
+            if ($transport instanceof Autowire){
92 92
                 $transport = $transport->resolve($factory);
93 93
             }
94 94
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,8 +87,10 @@
 block discarded – undo
87 87
         $registry = new TransportRegistry();
88 88
         $registry->setDefaultTransport($config->getDefaultTransport());
89 89
 
90
-        foreach ($config->getTransports() as $name => $transport) {
91
-            if ($transport instanceof Autowire) {
90
+        foreach ($config->getTransports() as $name => $transport)
91
+        {
92
+            if ($transport instanceof Autowire)
93
+            {
92 94
                 $transport = $transport->resolve($factory);
93 95
             }
94 96
 
Please login to merge, or discard this patch.
src/Framework/Bootloader/Auth/AuthBootloader.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function getActor(TokenInterface $token): ?object
54 54
     {
55
-        foreach ($this->getProviders() as $provider) {
56
-            if (!$provider instanceof ActorProviderInterface) {
55
+        foreach ($this->getProviders() as $provider){
56
+            if (!$provider instanceof ActorProviderInterface){
57 57
                 throw new AuthException(
58 58
                     sprintf(
59 59
                         'Expected `ActorProviderInterface`, got `%s`',
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
             }
64 64
 
65 65
             $actor = $provider->getActor($token);
66
-            if ($actor !== null) {
66
+            if ($actor !== null){
67 67
                 return $actor;
68 68
             }
69 69
         }
70 70
 
71
-        if ($this->actorProvider === []) {
71
+        if ($this->actorProvider === []){
72 72
             throw new AuthException('No actor provider');
73 73
         }
74 74
 
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
      */
91 91
     private function getProviders(): \Generator
92 92
     {
93
-        foreach ($this->actorProvider as $provider) {
94
-            if ($provider instanceof Autowire) {
93
+        foreach ($this->actorProvider as $provider){
94
+            if ($provider instanceof Autowire){
95 95
                 yield $provider->resolve($this->factory);
96 96
                 continue;
97 97
             }
98 98
 
99
-            if (is_object($provider)) {
99
+            if (is_object($provider)){
100 100
                 yield $provider;
101 101
                 continue;
102 102
             }
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -52,8 +52,10 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function getActor(TokenInterface $token): ?object
54 54
     {
55
-        foreach ($this->getProviders() as $provider) {
56
-            if (!$provider instanceof ActorProviderInterface) {
55
+        foreach ($this->getProviders() as $provider)
56
+        {
57
+            if (!$provider instanceof ActorProviderInterface)
58
+            {
57 59
                 throw new AuthException(
58 60
                     sprintf(
59 61
                         'Expected `ActorProviderInterface`, got `%s`',
@@ -63,12 +65,14 @@  discard block
 block discarded – undo
63 65
             }
64 66
 
65 67
             $actor = $provider->getActor($token);
66
-            if ($actor !== null) {
68
+            if ($actor !== null)
69
+            {
67 70
                 return $actor;
68 71
             }
69 72
         }
70 73
 
71
-        if ($this->actorProvider === []) {
74
+        if ($this->actorProvider === [])
75
+        {
72 76
             throw new AuthException('No actor provider');
73 77
         }
74 78
 
@@ -90,13 +94,16 @@  discard block
 block discarded – undo
90 94
      */
91 95
     private function getProviders(): \Generator
92 96
     {
93
-        foreach ($this->actorProvider as $provider) {
94
-            if ($provider instanceof Autowire) {
97
+        foreach ($this->actorProvider as $provider)
98
+        {
99
+            if ($provider instanceof Autowire)
100
+            {
95 101
                 yield $provider->resolve($this->factory);
96 102
                 continue;
97 103
             }
98 104
 
99
-            if (is_object($provider)) {
105
+            if (is_object($provider))
106
+            {
100 107
                 yield $provider;
101 108
                 continue;
102 109
             }
Please login to merge, or discard this patch.
src/Framework/Bootloader/ConsoleBootloader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@
 block discarded – undo
128 128
         string $footer,
129 129
         array $options
130 130
     ): Append {
131
-        if (is_array($sequence) || $sequence instanceof \Closure) {
131
+        if (is_array($sequence) || $sequence instanceof \Closure){
132 132
             return new Append(
133 133
                 $target,
134 134
                 null,
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,8 @@
 block discarded – undo
133 133
         string $footer,
134 134
         array $options
135 135
     ): Append {
136
-        if (is_array($sequence) || $sequence instanceof \Closure) {
136
+        if (is_array($sequence) || $sequence instanceof \Closure)
137
+        {
137 138
             return new Append(
138 139
                 $target,
139 140
                 null,
Please login to merge, or discard this patch.
src/Framework/Auth/AuthScope.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,9 +94,9 @@
 block discarded – undo
94 94
      */
95 95
     private function getAuthContext(): AuthContextInterface
96 96
     {
97
-        try {
97
+        try{
98 98
             return $this->container->get(AuthContextInterface::class);
99
-        } catch (NotFoundExceptionInterface $e) {
99
+        }catch (NotFoundExceptionInterface $e){
100 100
             throw new ScopeException('Unable to resolve auth context, invalid scope', $e->getCode(), $e);
101 101
         }
102 102
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,9 +94,12 @@
 block discarded – undo
94 94
      */
95 95
     private function getAuthContext(): AuthContextInterface
96 96
     {
97
-        try {
97
+        try
98
+        {
98 99
             return $this->container->get(AuthContextInterface::class);
99
-        } catch (NotFoundExceptionInterface $e) {
100
+        }
101
+        catch (NotFoundExceptionInterface $e)
102
+        {
100 103
             throw new ScopeException('Unable to resolve auth context, invalid scope', $e->getCode(), $e);
101 104
         }
102 105
     }
Please login to merge, or discard this patch.
src/Framework/Auth/Cycle/TokenStorage.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function load(string $id): ?TokenInterface
48 48
     {
49
-        if (strpos($id, ':') === false) {
49
+        if (strpos($id, ':') === false){
50 50
             return null;
51 51
         }
52 52
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         /** @var Token $token */
56 56
         $token = $this->orm->getRepository(Token::class)->findByPK($pk);
57 57
 
58
-        if ($token === null || !hash_equals($token->getHashedValue(), hash('sha512', $hash))) {
58
+        if ($token === null || !hash_equals($token->getHashedValue(), hash('sha512', $hash))){
59 59
             // hijacked or deleted
60 60
             return null;
61 61
         }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         $token->setSecretValue($hash);
64 64
 
65 65
         $expiresAt = $token->getExpiresAt();
66
-        if ($expiresAt !== null && $expiresAt < new DateTimeImmutable()) {
66
+        if ($expiresAt !== null && $expiresAt < new DateTimeImmutable()){
67 67
             $this->delete($token);
68 68
             return null;
69 69
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function create(array $payload, DateTimeInterface $expiresAt = null): TokenInterface
78 78
     {
79
-        try {
79
+        try{
80 80
             $token = new Token(
81 81
                 $this->issueID(),
82 82
                 $this->randomHash(128),
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             $this->em->run();
90 90
 
91 91
             return $token;
92
-        } catch (Throwable $e) {
92
+        }catch (Throwable $e){
93 93
             throw new TokenStorageException('Unable to create token', $e->getCode(), $e);
94 94
         }
95 95
     }
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function delete(TokenInterface $token): void
101 101
     {
102
-        try {
102
+        try{
103 103
             $this->em->delete($token);
104 104
             $this->em->run();
105
-        } catch (Throwable $e) {
105
+        }catch (Throwable $e){
106 106
             throw new TokenStorageException('Unable to delete token', $e->getCode(), $e);
107 107
         }
108 108
     }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             ->select()
123 123
             ->from($this->orm->getSource(Token::class)->getTable());
124 124
 
125
-        while ((clone $query)->where('id', $id)->count('id') !== 0) {
125
+        while ((clone $query)->where('id', $id)->count('id') !== 0){
126 126
             $id = $this->randomHash(64);
127 127
         }
128 128
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,7 +46,8 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function load(string $id): ?TokenInterface
48 48
     {
49
-        if (strpos($id, ':') === false) {
49
+        if (strpos($id, ':') === false)
50
+        {
50 51
             return null;
51 52
         }
52 53
 
@@ -55,7 +56,8 @@  discard block
 block discarded – undo
55 56
         /** @var Token $token */
56 57
         $token = $this->orm->getRepository(Token::class)->findByPK($pk);
57 58
 
58
-        if ($token === null || !hash_equals($token->getHashedValue(), hash('sha512', $hash))) {
59
+        if ($token === null || !hash_equals($token->getHashedValue(), hash('sha512', $hash)))
60
+        {
59 61
             // hijacked or deleted
60 62
             return null;
61 63
         }
@@ -63,7 +65,8 @@  discard block
 block discarded – undo
63 65
         $token->setSecretValue($hash);
64 66
 
65 67
         $expiresAt = $token->getExpiresAt();
66
-        if ($expiresAt !== null && $expiresAt < new DateTimeImmutable()) {
68
+        if ($expiresAt !== null && $expiresAt < new DateTimeImmutable())
69
+        {
67 70
             $this->delete($token);
68 71
             return null;
69 72
         }
@@ -76,7 +79,8 @@  discard block
 block discarded – undo
76 79
      */
77 80
     public function create(array $payload, DateTimeInterface $expiresAt = null): TokenInterface
78 81
     {
79
-        try {
82
+        try
83
+        {
80 84
             $token = new Token(
81 85
                 $this->issueID(),
82 86
                 $this->randomHash(128),
@@ -89,7 +93,9 @@  discard block
 block discarded – undo
89 93
             $this->em->run();
90 94
 
91 95
             return $token;
92
-        } catch (Throwable $e) {
96
+        }
97
+        catch (Throwable $e)
98
+        {
93 99
             throw new TokenStorageException('Unable to create token', $e->getCode(), $e);
94 100
         }
95 101
     }
@@ -99,10 +105,13 @@  discard block
 block discarded – undo
99 105
      */
100 106
     public function delete(TokenInterface $token): void
101 107
     {
102
-        try {
108
+        try
109
+        {
103 110
             $this->em->delete($token);
104 111
             $this->em->run();
105
-        } catch (Throwable $e) {
112
+        }
113
+        catch (Throwable $e)
114
+        {
106 115
             throw new TokenStorageException('Unable to delete token', $e->getCode(), $e);
107 116
         }
108 117
     }
@@ -122,7 +131,8 @@  discard block
 block discarded – undo
122 131
             ->select()
123 132
             ->from($this->orm->getSource(Token::class)->getTable());
124 133
 
125
-        while ((clone $query)->where('id', $id)->count('id') !== 0) {
134
+        while ((clone $query)->where('id', $id)->count('id') !== 0)
135
+        {
126 136
             $id = $this->randomHash(64);
127 137
         }
128 138
 
Please login to merge, or discard this patch.
src/Framework/Auth/Cycle/Token.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         array $payload,
52 52
         DateTimeInterface $createdAt,
53 53
         DateTimeInterface $expiresAt = null
54
-    ) {
54
+    ){
55 55
         $this->id = $id;
56 56
 
57 57
         $this->secretValue = $secretValue;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function getPayload(): array
110 110
     {
111
-        if (is_resource($this->payload)) {
111
+        if (is_resource($this->payload)){
112 112
             // postgres
113 113
             return json_decode(stream_get_contents($this->payload), true);
114 114
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,8 @@
 block discarded – undo
108 108
      */
109 109
     public function getPayload(): array
110 110
     {
111
-        if (is_resource($this->payload)) {
111
+        if (is_resource($this->payload))
112
+        {
112 113
             // postgres
113 114
             return json_decode(stream_get_contents($this->payload), true);
114 115
         }
Please login to merge, or discard this patch.
src/Framework/Auth/Session/TokenStorage.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -43,23 +43,23 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function load(string $id): ?TokenInterface
45 45
     {
46
-        try {
46
+        try{
47 47
             $tokenData = $this->session->getSection(self::SESSION_SECTION)->get('token');
48
-            if ($tokenData === null) {
48
+            if ($tokenData === null){
49 49
                 return null;
50 50
             }
51 51
 
52 52
             $token = Token::unpack($tokenData);
53
-        } catch (Throwable $e) {
53
+        }catch (Throwable $e){
54 54
             throw new TokenStorageException('Unable to load session token', $e->getCode(), $e);
55 55
         }
56 56
 
57
-        if (!hash_equals($token->getID(), $id)) {
57
+        if (!hash_equals($token->getID(), $id)){
58 58
             return null;
59 59
         }
60 60
 
61 61
         $expiresAt = $token->getExpiresAt();
62
-        if ($expiresAt !== null && $expiresAt < new DateTimeImmutable()) {
62
+        if ($expiresAt !== null && $expiresAt < new DateTimeImmutable()){
63 63
             $this->delete($token);
64 64
             return null;
65 65
         }
@@ -72,12 +72,12 @@  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($this->randomHash(128), $payload, $expiresAt);
77 77
             $this->session->getSection(self::SESSION_SECTION)->set('token', $token->pack());
78 78
 
79 79
             return $token;
80
-        } catch (Throwable $e) {
80
+        }catch (Throwable $e){
81 81
             throw new TokenStorageException('Unable to create session token', $e->getCode(), $e);
82 82
         }
83 83
     }
Please login to merge, or discard this patch.
Braces   +16 added lines, -7 removed lines patch added patch discarded remove patch
@@ -43,23 +43,29 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function load(string $id): ?TokenInterface
45 45
     {
46
-        try {
46
+        try
47
+        {
47 48
             $tokenData = $this->session->getSection(self::SESSION_SECTION)->get('token');
48
-            if ($tokenData === null) {
49
+            if ($tokenData === null)
50
+            {
49 51
                 return null;
50 52
             }
51 53
 
52 54
             $token = Token::unpack($tokenData);
53
-        } catch (Throwable $e) {
55
+        }
56
+        catch (Throwable $e)
57
+        {
54 58
             throw new TokenStorageException('Unable to load session token', $e->getCode(), $e);
55 59
         }
56 60
 
57
-        if (!hash_equals($token->getID(), $id)) {
61
+        if (!hash_equals($token->getID(), $id))
62
+        {
58 63
             return null;
59 64
         }
60 65
 
61 66
         $expiresAt = $token->getExpiresAt();
62
-        if ($expiresAt !== null && $expiresAt < new DateTimeImmutable()) {
67
+        if ($expiresAt !== null && $expiresAt < new DateTimeImmutable())
68
+        {
63 69
             $this->delete($token);
64 70
             return null;
65 71
         }
@@ -72,12 +78,15 @@  discard block
 block discarded – undo
72 78
      */
73 79
     public function create(array $payload, DateTimeInterface $expiresAt = null): TokenInterface
74 80
     {
75
-        try {
81
+        try
82
+        {
76 83
             $token = new Token($this->randomHash(128), $payload, $expiresAt);
77 84
             $this->session->getSection(self::SESSION_SECTION)->set('token', $token->pack());
78 85
 
79 86
             return $token;
80
-        } catch (Throwable $e) {
87
+        }
88
+        catch (Throwable $e)
89
+        {
81 90
             throw new TokenStorageException('Unable to create session token', $e->getCode(), $e);
82 91
         }
83 92
     }
Please login to merge, or discard this patch.