Passed
Pull Request — master (#737)
by Vadim
07:15
created
src/Framework/Security/GuardScope.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         PermissionsInterface $permissions,
42 42
         ContainerInterface $actorScope,
43 43
         array $roles = []
44
-    ) {
44
+    ){
45 45
         $this->roles = $roles;
46 46
         $this->container = $actorScope;
47 47
         $this->permissions = $permissions;
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
     public function allows(string $permission, array $context = []): bool
56 56
     {
57 57
         $allows = false;
58
-        foreach ($this->getRoles() as $role) {
59
-            if (!$this->permissions->hasRole($role)) {
58
+        foreach ($this->getRoles() as $role){
59
+            if (!$this->permissions->hasRole($role)){
60 60
                 continue;
61 61
             }
62 62
 
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function getActor(): ActorInterface
105 105
     {
106
-        if (!is_null($this->actor)) {
106
+        if (!is_null($this->actor)){
107 107
             return $this->actor;
108 108
         }
109 109
 
110
-        try {
110
+        try{
111 111
             return $this->container->get(ActorInterface::class);
112
-        } catch (NotFoundExceptionInterface $e) {
112
+        }catch (NotFoundExceptionInterface $e){
113 113
             throw new ScopeException('Unable to resolve Actor from the scope', $e->getCode(), $e);
114 114
         }
115 115
     }
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,8 +55,10 @@  discard block
 block discarded – undo
55 55
     public function allows(string $permission, array $context = []): bool
56 56
     {
57 57
         $allows = false;
58
-        foreach ($this->getRoles() as $role) {
59
-            if (!$this->permissions->hasRole($role)) {
58
+        foreach ($this->getRoles() as $role)
59
+        {
60
+            if (!$this->permissions->hasRole($role))
61
+            {
60 62
                 continue;
61 63
             }
62 64
 
@@ -103,13 +105,17 @@  discard block
 block discarded – undo
103 105
      */
104 106
     public function getActor(): ActorInterface
105 107
     {
106
-        if (!is_null($this->actor)) {
108
+        if (!is_null($this->actor))
109
+        {
107 110
             return $this->actor;
108 111
         }
109 112
 
110
-        try {
113
+        try
114
+        {
111 115
             return $this->container->get(ActorInterface::class);
112
-        } catch (NotFoundExceptionInterface $e) {
116
+        }
117
+        catch (NotFoundExceptionInterface $e)
118
+        {
113 119
             throw new ScopeException('Unable to resolve Actor from the scope', $e->getCode(), $e);
114 120
         }
115 121
     }
Please login to merge, or discard this patch.
src/Framework/Filter/InputScope.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
      */
42 42
     public function getValue(string $source, string $name = null)
43 43
     {
44
-        if (!method_exists($this->input, $source)) {
44
+        if (!method_exists($this->input, $source)){
45 45
             throw new InputException("Undefined input source '{$source}'");
46 46
         }
47 47
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,8 @@
 block discarded – undo
41 41
      */
42 42
     public function getValue(string $source, string $name = null)
43 43
     {
44
-        if (!method_exists($this->input, $source)) {
44
+        if (!method_exists($this->input, $source))
45
+        {
45 46
             throw new InputException("Undefined input source '{$source}'");
46 47
         }
47 48
 
Please login to merge, or discard this patch.
src/Framework/Cycle/RepositoryInjector.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@
 block discarded – undo
42 42
     {
43 43
         $schema = $this->orm->getSchema();
44 44
 
45
-        foreach ($schema->getRoles() as $role) {
45
+        foreach ($schema->getRoles() as $role){
46 46
             $repository = $schema->define($role, Schema::REPOSITORY);
47 47
 
48 48
             if (
49 49
                 $repository !== Select\Repository::class
50 50
                 && $repository === $class->getName()
51
-            ) {
51
+            ){
52 52
                 return $this->orm->getRepository($role);
53 53
             }
54 54
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,8 @@
 block discarded – undo
42 42
     {
43 43
         $schema = $this->orm->getSchema();
44 44
 
45
-        foreach ($schema->getRoles() as $role) {
45
+        foreach ($schema->getRoles() as $role)
46
+        {
46 47
             $repository = $schema->define($role, Schema::REPOSITORY);
47 48
 
48 49
             if (
Please login to merge, or discard this patch.
src/Framework/Http/Diactoros/UploadedFileFactory.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
         string $clientFilename = null,
27 27
         string $clientMediaType = null
28 28
     ): UploadedFileInterface {
29
-        if ($size === null) {
29
+        if ($size === null){
30 30
             $size = $stream->getSize();
31 31
         }
32 32
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@
 block discarded – undo
26 26
         string $clientFilename = null,
27 27
         string $clientMediaType = null
28 28
     ): UploadedFileInterface {
29
-        if ($size === null) {
29
+        if ($size === null)
30
+        {
30 31
             $size = $stream->getSize();
31 32
         }
32 33
 
Please login to merge, or discard this patch.
src/Framework/Http/Diactoros/ResponseFactory.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
         $response = new Response('php://memory', $code, []);
38 38
         $response = $response->withStatus($code, $reasonPhrase);
39 39
 
40
-        foreach ($this->config->getBaseHeaders() as $header => $value) {
40
+        foreach ($this->config->getBaseHeaders() as $header => $value){
41 41
             $response = $response->withAddedHeader($header, $value);
42 42
         }
43 43
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,8 @@
 block discarded – undo
37 37
         $response = new Response('php://memory', $code, []);
38 38
         $response = $response->withStatus($code, $reasonPhrase);
39 39
 
40
-        foreach ($this->config->getBaseHeaders() as $header => $value) {
40
+        foreach ($this->config->getBaseHeaders() as $header => $value)
41
+        {
41 42
             $response = $response->withAddedHeader($header, $value);
42 43
         }
43 44
 
Please login to merge, or discard this patch.
src/Framework/Http/PaginationFactory.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function createPaginator(string $parameter, int $limit = 25): PaginatorInterface
48 48
     {
49
-        if (!$this->container->has(ServerRequestInterface::class)) {
49
+        if (!$this->container->has(ServerRequestInterface::class)){
50 50
             throw new ScopeException('Unable to create paginator, no request scope found');
51 51
         }
52 52
         /**
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
         //Getting page number
58 58
         $page = 0;
59
-        if (!empty($query[$parameter]) && is_scalar($query[$parameter])) {
59
+        if (!empty($query[$parameter]) && is_scalar($query[$parameter])){
60 60
             $page = (int)$query[$parameter];
61 61
         }
62 62
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,8 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function createPaginator(string $parameter, int $limit = 25): PaginatorInterface
48 48
     {
49
-        if (!$this->container->has(ServerRequestInterface::class)) {
49
+        if (!$this->container->has(ServerRequestInterface::class))
50
+        {
50 51
             throw new ScopeException('Unable to create paginator, no request scope found');
51 52
         }
52 53
         /**
@@ -56,7 +57,8 @@  discard block
 block discarded – undo
56 57
 
57 58
         //Getting page number
58 59
         $page = 0;
59
-        if (!empty($query[$parameter]) && is_scalar($query[$parameter])) {
60
+        if (!empty($query[$parameter]) && is_scalar($query[$parameter]))
61
+        {
60 62
             $page = (int)$query[$parameter];
61 63
         }
62 64
 
Please login to merge, or discard this patch.
src/Framework/Http/Middleware/JsonPayloadMiddleware.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
45 45
     {
46
-        if ($this->isJsonPayload($request)) {
46
+        if ($this->isJsonPayload($request)){
47 47
             $body = (string)$request->getBody();
48
-            if ($body !== '') {
48
+            if ($body !== ''){
49 49
                 $request = $request->withParsedBody(json_decode($body, true));
50
-                if (json_last_error() !== 0) {
50
+                if (json_last_error() !== 0){
51 51
                     throw new ClientException(400, 'invalid json payload');
52 52
                 }
53 53
             }
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $contentType = $request->getHeaderLine('Content-Type');
66 66
 
67
-        foreach ($this->config->getContentTypes() as $allowedType) {
68
-            if (stripos($contentType, $allowedType) === 0) {
67
+        foreach ($this->config->getContentTypes() as $allowedType){
68
+            if (stripos($contentType, $allowedType) === 0){
69 69
                 return true;
70 70
             }
71 71
         }
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,11 +43,14 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
45 45
     {
46
-        if ($this->isJsonPayload($request)) {
46
+        if ($this->isJsonPayload($request))
47
+        {
47 48
             $body = (string)$request->getBody();
48
-            if ($body !== '') {
49
+            if ($body !== '')
50
+            {
49 51
                 $request = $request->withParsedBody(json_decode($body, true));
50
-                if (json_last_error() !== 0) {
52
+                if (json_last_error() !== 0)
53
+                {
51 54
                     throw new ClientException(400, 'invalid json payload');
52 55
                 }
53 56
             }
@@ -64,8 +67,10 @@  discard block
 block discarded – undo
64 67
     {
65 68
         $contentType = $request->getHeaderLine('Content-Type');
66 69
 
67
-        foreach ($this->config->getContentTypes() as $allowedType) {
68
-            if (stripos($contentType, $allowedType) === 0) {
70
+        foreach ($this->config->getContentTypes() as $allowedType)
71
+        {
72
+            if (stripos($contentType, $allowedType) === 0)
73
+            {
69 74
                 return true;
70 75
             }
71 76
         }
Please login to merge, or discard this patch.
src/Framework/Jobs/JobDispatcher.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         EnvironmentInterface $env,
40 40
         FinalizerInterface $finalizer,
41 41
         ContainerInterface $container
42
-    ) {
42
+    ){
43 43
         $this->env = $env;
44 44
         $this->finalizer = $finalizer;
45 45
         $this->container = $container;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         $consumer->serve(
71 71
             $worker,
72 72
             function (\Throwable $e = null): void {
73
-                if ($e !== null) {
73
+                if ($e !== null){
74 74
                     $this->handleException($e);
75 75
                 }
76 76
 
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
      */
85 85
     protected function handleException(\Throwable $e): void
86 86
     {
87
-        try {
87
+        try{
88 88
             $this->container->get(SnapshotterInterface::class)->register($e);
89
-        } catch (\Throwable | ContainerExceptionInterface $se) {
89
+        }catch (\Throwable | ContainerExceptionInterface $se){
90 90
             // no need to notify when unable to register an exception
91 91
         }
92 92
     }
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -70,7 +70,8 @@  discard block
 block discarded – undo
70 70
         $consumer->serve(
71 71
             $worker,
72 72
             function (\Throwable $e = null): void {
73
-                if ($e !== null) {
73
+                if ($e !== null)
74
+                {
74 75
                     $this->handleException($e);
75 76
                 }
76 77
 
@@ -84,9 +85,12 @@  discard block
 block discarded – undo
84 85
      */
85 86
     protected function handleException(\Throwable $e): void
86 87
     {
87
-        try {
88
+        try
89
+        {
88 90
             $this->container->get(SnapshotterInterface::class)->register($e);
89
-        } catch (\Throwable | ContainerExceptionInterface $se) {
91
+        }
92
+        catch (\Throwable | ContainerExceptionInterface $se)
93
+        {
90 94
             // no need to notify when unable to register an exception
91 95
         }
92 96
     }
Please login to merge, or discard this patch.
src/Framework/Jobs/JobQueue.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@
 block discarded – undo
42 42
      */
43 43
     public function push(string $jobType, array $payload = [], Options $options = null): string
44 44
     {
45
-        if ($options === null) {
45
+        if ($options === null){
46 46
             $options = new Options();
47 47
         }
48 48
 
49 49
         $pipeline = $this->registry->getPipeline($jobType);
50
-        if ($pipeline !== null && $options->getPipeline() === null) {
50
+        if ($pipeline !== null && $options->getPipeline() === null){
51 51
             $options = $options->withPipeline($pipeline);
52 52
         }
53 53
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,12 +42,14 @@
 block discarded – undo
42 42
      */
43 43
     public function push(string $jobType, array $payload = [], Options $options = null): string
44 44
     {
45
-        if ($options === null) {
45
+        if ($options === null)
46
+        {
46 47
             $options = new Options();
47 48
         }
48 49
 
49 50
         $pipeline = $this->registry->getPipeline($jobType);
50
-        if ($pipeline !== null && $options->getPipeline() === null) {
51
+        if ($pipeline !== null && $options->getPipeline() === null)
52
+        {
51 53
             $options = $options->withPipeline($pipeline);
52 54
         }
53 55
 
Please login to merge, or discard this patch.