@@ -142,7 +142,7 @@ |
||
142 | 142 | $v = $this->validation->validate([ |
143 | 143 | 'i' => 'third' |
144 | 144 | ], [ |
145 | - 'i' => static function () { |
|
145 | + 'i' => static function (){ |
|
146 | 146 | return false; |
147 | 147 | } |
148 | 148 | ]); |
@@ -142,7 +142,8 @@ |
||
142 | 142 | $v = $this->validation->validate([ |
143 | 143 | 'i' => 'third' |
144 | 144 | ], [ |
145 | - 'i' => static function () { |
|
145 | + 'i' => static function () |
|
146 | + { |
|
146 | 147 | return false; |
147 | 148 | } |
148 | 149 | ]); |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | { |
38 | 38 | //De-mapping |
39 | 39 | $mapped = []; |
40 | - foreach ($errors as $field => $message) { |
|
41 | - if (!isset($this->schema[$field])) { |
|
40 | + foreach ($errors as $field => $message){ |
|
41 | + if (!isset($this->schema[$field])){ |
|
42 | 42 | $mapped[$field] = $message; |
43 | 43 | continue; |
44 | 44 | } |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | */ |
61 | 61 | private function mount(array &$array, string $path, $message): void |
62 | 62 | { |
63 | - if ($path === '.') { |
|
63 | + if ($path === '.'){ |
|
64 | 64 | throw new SchemaException( |
65 | 65 | "Unable to mount error `{$message}` to `{$path}` (root path is forbidden)" |
66 | 66 | ); |
67 | 67 | } |
68 | 68 | |
69 | 69 | $step = explode('.', $path); |
70 | - while ($name = array_shift($step)) { |
|
70 | + while ($name = array_shift($step)){ |
|
71 | 71 | $array = &$array[$name]; |
72 | 72 | } |
73 | 73 |
@@ -37,8 +37,10 @@ discard block |
||
37 | 37 | { |
38 | 38 | //De-mapping |
39 | 39 | $mapped = []; |
40 | - foreach ($errors as $field => $message) { |
|
41 | - if (!isset($this->schema[$field])) { |
|
40 | + foreach ($errors as $field => $message) |
|
41 | + { |
|
42 | + if (!isset($this->schema[$field])) |
|
43 | + { |
|
42 | 44 | $mapped[$field] = $message; |
43 | 45 | continue; |
44 | 46 | } |
@@ -60,14 +62,16 @@ discard block |
||
60 | 62 | */ |
61 | 63 | private function mount(array &$array, string $path, $message): void |
62 | 64 | { |
63 | - if ($path === '.') { |
|
65 | + if ($path === '.') |
|
66 | + { |
|
64 | 67 | throw new SchemaException( |
65 | 68 | "Unable to mount error `{$message}` to `{$path}` (root path is forbidden)" |
66 | 69 | ); |
67 | 70 | } |
68 | 71 | |
69 | 72 | $step = explode('.', $path); |
70 | - while ($name = array_shift($step)) { |
|
73 | + while ($name = array_shift($step)) |
|
74 | + { |
|
71 | 75 | $array = &$array[$name]; |
72 | 76 | } |
73 | 77 |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | public function withPrefix(string $prefix, bool $add = true): InputInterface |
39 | 39 | { |
40 | 40 | $input = clone $this; |
41 | - if ($add) { |
|
42 | - $input->prefix .= '.' . $prefix; |
|
41 | + if ($add){ |
|
42 | + $input->prefix .= '.'.$prefix; |
|
43 | 43 | $input->prefix = trim($input->prefix, '.'); |
44 | - } else { |
|
44 | + }else{ |
|
45 | 45 | $input->prefix = $prefix; |
46 | 46 | } |
47 | 47 | return $input; |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function getValue(string $source, string $name = null) |
54 | 54 | { |
55 | - try { |
|
55 | + try{ |
|
56 | 56 | return $this->dotGet($name); |
57 | - } catch (DotNotFoundException $e) { |
|
57 | + }catch (DotNotFoundException $e){ |
|
58 | 58 | return null; |
59 | 59 | } |
60 | 60 | } |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | $data = $this->data; |
73 | 73 | |
74 | 74 | //Generating path relative to a given name and prefix |
75 | - $path = (!empty($this->prefix) ? $this->prefix . '.' : '') . $name; |
|
76 | - if (empty($path)) { |
|
75 | + $path = (!empty($this->prefix) ? $this->prefix.'.' : '').$name; |
|
76 | + if (empty($path)){ |
|
77 | 77 | return $data; |
78 | 78 | } |
79 | 79 | |
80 | 80 | $path = explode('.', rtrim($path, '.')); |
81 | - foreach ($path as $step) { |
|
82 | - if (!is_array($data) || !array_key_exists($step, $data)) { |
|
81 | + foreach ($path as $step){ |
|
82 | + if (!is_array($data) || !array_key_exists($step, $data)){ |
|
83 | 83 | throw new DotNotFoundException("Unable to find requested element '{$name}'"); |
84 | 84 | } |
85 | 85 | $data = &$data[$step]; |
@@ -38,10 +38,13 @@ discard block |
||
38 | 38 | public function withPrefix(string $prefix, bool $add = true): InputInterface |
39 | 39 | { |
40 | 40 | $input = clone $this; |
41 | - if ($add) { |
|
41 | + if ($add) |
|
42 | + { |
|
42 | 43 | $input->prefix .= '.' . $prefix; |
43 | 44 | $input->prefix = trim($input->prefix, '.'); |
44 | - } else { |
|
45 | + } |
|
46 | + else |
|
47 | + { |
|
45 | 48 | $input->prefix = $prefix; |
46 | 49 | } |
47 | 50 | return $input; |
@@ -52,9 +55,12 @@ discard block |
||
52 | 55 | */ |
53 | 56 | public function getValue(string $source, string $name = null) |
54 | 57 | { |
55 | - try { |
|
58 | + try |
|
59 | + { |
|
56 | 60 | return $this->dotGet($name); |
57 | - } catch (DotNotFoundException $e) { |
|
61 | + } |
|
62 | + catch (DotNotFoundException $e) |
|
63 | + { |
|
58 | 64 | return null; |
59 | 65 | } |
60 | 66 | } |
@@ -73,13 +79,16 @@ discard block |
||
73 | 79 | |
74 | 80 | //Generating path relative to a given name and prefix |
75 | 81 | $path = (!empty($this->prefix) ? $this->prefix . '.' : '') . $name; |
76 | - if (empty($path)) { |
|
82 | + if (empty($path)) |
|
83 | + { |
|
77 | 84 | return $data; |
78 | 85 | } |
79 | 86 | |
80 | 87 | $path = explode('.', rtrim($path, '.')); |
81 | - foreach ($path as $step) { |
|
82 | - if (!is_array($data) || !array_key_exists($step, $data)) { |
|
88 | + foreach ($path as $step) |
|
89 | + { |
|
90 | + if (!is_array($data) || !array_key_exists($step, $data)) |
|
91 | + { |
|
83 | 92 | throw new DotNotFoundException("Unable to find requested element '{$name}'"); |
84 | 93 | } |
85 | 94 | $data = &$data[$step]; |
@@ -18,6 +18,6 @@ |
||
18 | 18 | { |
19 | 19 | public function process(string $controller, string $action, array $parameters, CoreInterface $core) |
20 | 20 | { |
21 | - return '?' . $core->callAction($controller, $action, $parameters) . '!'; |
|
21 | + return '?'.$core->callAction($controller, $action, $parameters).'!'; |
|
22 | 22 | } |
23 | 23 | } |
@@ -56,12 +56,12 @@ |
||
56 | 56 | */ |
57 | 57 | public function callAction(string $controller, string $action, array $parameters = []) |
58 | 58 | { |
59 | - if ($this->core === null) { |
|
59 | + if ($this->core === null){ |
|
60 | 60 | throw new InterceptorException('Unable to invoke pipeline without assigned core'); |
61 | 61 | } |
62 | 62 | |
63 | 63 | $position = $this->position++; |
64 | - if (isset($this->interceptors[$position])) { |
|
64 | + if (isset($this->interceptors[$position])){ |
|
65 | 65 | return $this->interceptors[$position]->process($controller, $action, $parameters, $this); |
66 | 66 | } |
67 | 67 |
@@ -56,12 +56,14 @@ |
||
56 | 56 | */ |
57 | 57 | public function callAction(string $controller, string $action, array $parameters = []) |
58 | 58 | { |
59 | - if ($this->core === null) { |
|
59 | + if ($this->core === null) |
|
60 | + { |
|
60 | 61 | throw new InterceptorException('Unable to invoke pipeline without assigned core'); |
61 | 62 | } |
62 | 63 | |
63 | 64 | $position = $this->position++; |
64 | - if (isset($this->interceptors[$position])) { |
|
65 | + if (isset($this->interceptors[$position])) |
|
66 | + { |
|
65 | 67 | return $this->interceptors[$position]->process($controller, $action, $parameters, $this); |
66 | 68 | } |
67 | 69 |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function callAction(string $controller, string $action, array $parameters = []) |
47 | 47 | { |
48 | - try { |
|
48 | + try{ |
|
49 | 49 | $method = new \ReflectionMethod($controller, $action); |
50 | - } catch (\ReflectionException $e) { |
|
50 | + }catch (\ReflectionException $e){ |
|
51 | 51 | throw new ControllerException( |
52 | 52 | "Invalid action `{$controller}`->`{$action}`", |
53 | 53 | ControllerException::BAD_ACTION, |
@@ -55,22 +55,22 @@ discard block |
||
55 | 55 | ); |
56 | 56 | } |
57 | 57 | |
58 | - if ($method->isStatic() || !$method->isPublic()) { |
|
58 | + if ($method->isStatic() || !$method->isPublic()){ |
|
59 | 59 | throw new ControllerException( |
60 | 60 | "Invalid action `{$controller}`->`{$action}`", |
61 | 61 | ControllerException::BAD_ACTION |
62 | 62 | ); |
63 | 63 | } |
64 | 64 | |
65 | - try { |
|
65 | + try{ |
|
66 | 66 | // getting the set of arguments should be sent to requested method |
67 | 67 | $args = $this->resolver->resolveArguments($method, $parameters); |
68 | - } catch (ArgumentException $e) { |
|
68 | + }catch (ArgumentException $e){ |
|
69 | 69 | throw new ControllerException( |
70 | 70 | "Missing/invalid parameter '{$e->getParameter()->name}' of `{$controller}`->`{$action}`", |
71 | 71 | ControllerException::BAD_ARGUMENT |
72 | 72 | ); |
73 | - } catch (ContainerExceptionInterface $e) { |
|
73 | + }catch (ContainerExceptionInterface $e){ |
|
74 | 74 | throw new ControllerException( |
75 | 75 | $e->getMessage(), |
76 | 76 | ControllerException::ERROR, |
@@ -42,9 +42,12 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function callAction(string $controller, string $action, array $parameters = []) |
44 | 44 | { |
45 | - try { |
|
45 | + try |
|
46 | + { |
|
46 | 47 | $method = new \ReflectionMethod($controller, $action); |
47 | - } catch (\ReflectionException $e) { |
|
48 | + } |
|
49 | + catch (\ReflectionException $e) |
|
50 | + { |
|
48 | 51 | throw new ControllerException( |
49 | 52 | "Invalid action `{$controller}`->`{$action}`", |
50 | 53 | ControllerException::BAD_ACTION, |
@@ -52,22 +55,28 @@ discard block |
||
52 | 55 | ); |
53 | 56 | } |
54 | 57 | |
55 | - if ($method->isStatic() || !$method->isPublic()) { |
|
58 | + if ($method->isStatic() || !$method->isPublic()) |
|
59 | + { |
|
56 | 60 | throw new ControllerException( |
57 | 61 | "Invalid action `{$controller}`->`{$action}`", |
58 | 62 | ControllerException::BAD_ACTION |
59 | 63 | ); |
60 | 64 | } |
61 | 65 | |
62 | - try { |
|
66 | + try |
|
67 | + { |
|
63 | 68 | // getting the set of arguments should be sent to requested method |
64 | 69 | $args = $this->resolver->resolveArguments($method, $parameters); |
65 | - } catch (ArgumentException $e) { |
|
70 | + } |
|
71 | + catch (ArgumentException $e) |
|
72 | + { |
|
66 | 73 | throw new ControllerException( |
67 | 74 | "Missing/invalid parameter '{$e->getParameter()->name}' of `{$controller}`->`{$action}`", |
68 | 75 | ControllerException::BAD_ARGUMENT |
69 | 76 | ); |
70 | - } catch (ContainerExceptionInterface $e) { |
|
77 | + } |
|
78 | + catch (ContainerExceptionInterface $e) |
|
79 | + { |
|
71 | 80 | throw new ControllerException( |
72 | 81 | $e->getMessage(), |
73 | 82 | ControllerException::ERROR, |
@@ -103,9 +103,9 @@ |
||
103 | 103 | $this->assertSame('echoed', (string)$response->getBody()); |
104 | 104 | |
105 | 105 | $e = null; |
106 | - try { |
|
106 | + try{ |
|
107 | 107 | $router->handle(new ServerRequest([], [], new Uri('/test'))); |
108 | - } catch (UndefinedRouteException $e) { |
|
108 | + }catch (UndefinedRouteException $e){ |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | $this->assertNotNull($e, 'Autofill not fired'); |
@@ -103,9 +103,12 @@ |
||
103 | 103 | $this->assertSame('echoed', (string)$response->getBody()); |
104 | 104 | |
105 | 105 | $e = null; |
106 | - try { |
|
106 | + try |
|
107 | + { |
|
107 | 108 | $router->handle(new ServerRequest([], [], new Uri('/test'))); |
108 | - } catch (UndefinedRouteException $e) { |
|
109 | + } |
|
110 | + catch (UndefinedRouteException $e) |
|
111 | + { |
|
109 | 112 | } |
110 | 113 | |
111 | 114 | $this->assertNotNull($e, 'Autofill not fired'); |
@@ -37,7 +37,7 @@ |
||
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 |
@@ -37,7 +37,8 @@ |
||
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 |
@@ -26,7 +26,7 @@ |
||
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 |
@@ -26,7 +26,8 @@ |
||
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 |