Passed
Pull Request — master (#1038)
by Aleksei
11:08
created
src/Http/src/Header/AcceptHeaderItem.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -27,17 +27,17 @@  discard block
 block discarded – undo
27 27
 
28 28
     public function __toString(): string
29 29
     {
30
-        if ($this->value === '') {
30
+        if ($this->value === ''){
31 31
             return '';
32 32
         }
33 33
 
34 34
         $parts = [$this->value];
35 35
 
36
-        if ($this->quality < 1) {
36
+        if ($this->quality < 1){
37 37
             $parts[] = \sprintf('q=%s', $this->quality);
38 38
         }
39 39
 
40
-        foreach ($this->getParams() as $name => $value) {
40
+        foreach ($this->getParams() as $name => $value){
41 41
             $parts[] = \sprintf('%s=%s', $name, $value);
42 42
         }
43 43
 
@@ -55,20 +55,20 @@  discard block
 block discarded – undo
55 55
         $quality = 1.0;
56 56
         $params = [];
57 57
 
58
-        foreach ($elements as $element) {
58
+        foreach ($elements as $element){
59 59
             $parsed = \explode('=', \trim($element), 2);
60 60
 
61 61
             // Wrong params must be ignored
62
-            if (\count($parsed) !== 2) {
62
+            if (\count($parsed) !== 2){
63 63
                 continue;
64 64
             }
65 65
 
66 66
             $name = \trim($parsed[0]);
67 67
             $value = \trim($parsed[1]);
68 68
 
69
-            if (\strcasecmp($name, 'q') === 0) {
69
+            if (\strcasecmp($name, 'q') === 0){
70 70
                 $quality = (float)$value;
71
-            } else {
71
+            }else{
72 72
                 $params[$name] = $value;
73 73
             }
74 74
         }
@@ -127,15 +127,15 @@  discard block
 block discarded – undo
127 127
 
128 128
     private function setParams(array $params): void
129 129
     {
130
-        foreach ($params as $name => $value) {
131
-            if (\is_numeric($name) || !\is_scalar($value)) {
130
+        foreach ($params as $name => $value){
131
+            if (\is_numeric($name) || !\is_scalar($value)){
132 132
                 continue;
133 133
             }
134 134
 
135 135
             $name = \trim($name);
136 136
             $value = \trim((string)$value);
137 137
 
138
-            if ($name === '' || $value === '') {
138
+            if ($name === '' || $value === ''){
139 139
                 continue;
140 140
             }
141 141
 
Please login to merge, or discard this patch.
Braces   +21 added lines, -10 removed lines patch added patch discarded remove patch
@@ -27,17 +27,20 @@  discard block
 block discarded – undo
27 27
 
28 28
     public function __toString(): string
29 29
     {
30
-        if ($this->value === '') {
30
+        if ($this->value === '')
31
+        {
31 32
             return '';
32 33
         }
33 34
 
34 35
         $parts = [$this->value];
35 36
 
36
-        if ($this->quality < 1) {
37
+        if ($this->quality < 1)
38
+        {
37 39
             $parts[] = \sprintf('q=%s', $this->quality);
38 40
         }
39 41
 
40
-        foreach ($this->getParams() as $name => $value) {
42
+        foreach ($this->getParams() as $name => $value)
43
+        {
41 44
             $parts[] = \sprintf('%s=%s', $name, $value);
42 45
         }
43 46
 
@@ -55,20 +58,25 @@  discard block
 block discarded – undo
55 58
         $quality = 1.0;
56 59
         $params = [];
57 60
 
58
-        foreach ($elements as $element) {
61
+        foreach ($elements as $element)
62
+        {
59 63
             $parsed = \explode('=', \trim($element), 2);
60 64
 
61 65
             // Wrong params must be ignored
62
-            if (\count($parsed) !== 2) {
66
+            if (\count($parsed) !== 2)
67
+            {
63 68
                 continue;
64 69
             }
65 70
 
66 71
             $name = \trim($parsed[0]);
67 72
             $value = \trim($parsed[1]);
68 73
 
69
-            if (\strcasecmp($name, 'q') === 0) {
74
+            if (\strcasecmp($name, 'q') === 0)
75
+            {
70 76
                 $quality = (float)$value;
71
-            } else {
77
+            }
78
+            else
79
+            {
72 80
                 $params[$name] = $value;
73 81
             }
74 82
         }
@@ -127,15 +135,18 @@  discard block
 block discarded – undo
127 135
 
128 136
     private function setParams(array $params): void
129 137
     {
130
-        foreach ($params as $name => $value) {
131
-            if (\is_numeric($name) || !\is_scalar($value)) {
138
+        foreach ($params as $name => $value)
139
+        {
140
+            if (\is_numeric($name) || !\is_scalar($value))
141
+            {
132 142
                 continue;
133 143
             }
134 144
 
135 145
             $name = \trim($name);
136 146
             $value = \trim((string)$value);
137 147
 
138
-            if ($name === '' || $value === '') {
148
+            if ($name === '' || $value === '')
149
+            {
139 150
                 continue;
140 151
             }
141 152
 
Please login to merge, or discard this patch.
src/Http/src/ResponseWrapper.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         private readonly ResponseFactoryInterface $responseFactory,
26 26
         private readonly StreamFactoryInterface $streamFactory,
27 27
         private readonly FilesInterface $files
28
-    ) {
28
+    ){
29 29
     }
30 30
 
31 31
     public function create(int $code): ResponseInterface
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      * @throws ResponseException
40 40
      */
41 41
     public function redirect(
42
-        string|UriInterface $uri,
42
+        string | UriInterface $uri,
43 43
         int $code = 302
44 44
     ): ResponseInterface {
45 45
         return $this->responseFactory->createResponse($code)->withHeader('Location', (string)$uri);
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
         string $name = '',
68 68
         string $mime = 'application/octet-stream'
69 69
     ): ResponseInterface {
70
-        if (empty($name)) {
71
-            if (!\is_string($filename)) {
70
+        if (empty($name)){
71
+            if (!\is_string($filename)){
72 72
                 throw new ResponseException('Unable to resolve public filename');
73 73
             }
74 74
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         $response = $response->withHeader('Content-Length', (string)$stream->getSize());
83 83
         $response = $response->withHeader(
84 84
             'Content-Disposition',
85
-            'attachment; filename="' . \addcslashes($name, '"') . '"'
85
+            'attachment; filename="'.\addcslashes($name, '"').'"'
86 86
         );
87 87
 
88 88
         return $response->withBody($stream);
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,8 +67,10 @@
 block discarded – undo
67 67
         string $name = '',
68 68
         string $mime = 'application/octet-stream'
69 69
     ): ResponseInterface {
70
-        if (empty($name)) {
71
-            if (!\is_string($filename)) {
70
+        if (empty($name))
71
+        {
72
+            if (!\is_string($filename))
73
+            {
72 74
                 throw new ResponseException('Unable to resolve public filename');
73 75
             }
74 76
 
Please login to merge, or discard this patch.
src/SendIt/tests/JobTest.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 
58 58
         $this->mailer->expects('send')->with($email)->andThrow(new TransportException('failed'));
59 59
 
60
-        try {
60
+        try{
61 61
             $this->getHandler()->handle(
62 62
                 MailQueue::JOB_NAME,
63 63
                 'id',
64 64
                 json_encode(MessageSerializer::pack($this->getMail()))
65 65
             );
66
-        } catch (TransportException $e) {
66
+        }catch (TransportException $e){
67 67
         }
68 68
     }
69 69
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     private function expectRenderer(Email $email): void
122 122
     {
123 123
         $this->renderer->expects('render')->withArgs(
124
-            function (Message $message) {
124
+            function (Message $message){
125 125
                 $this->assertSame($message->getSubject(), 'test');
126 126
                 return true;
127 127
             }
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,13 +57,16 @@  discard block
 block discarded – undo
57 57
 
58 58
         $this->mailer->expects('send')->with($email)->andThrow(new TransportException('failed'));
59 59
 
60
-        try {
60
+        try
61
+        {
61 62
             $this->getHandler()->handle(
62 63
                 MailQueue::JOB_NAME,
63 64
                 'id',
64 65
                 json_encode(MessageSerializer::pack($this->getMail()))
65 66
             );
66
-        } catch (TransportException $e) {
67
+        }
68
+        catch (TransportException $e)
69
+        {
67 70
         }
68 71
     }
69 72
 
@@ -121,7 +124,8 @@  discard block
 block discarded – undo
121 124
     private function expectRenderer(Email $email): void
122 125
     {
123 126
         $this->renderer->expects('render')->withArgs(
124
-            function (Message $message) {
127
+            function (Message $message)
128
+            {
125 129
                 $this->assertSame($message->getSubject(), 'test');
126 130
                 return true;
127 131
             }
Please login to merge, or discard this patch.
src/SendIt/tests/JobsQueueTest.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@
 block discarded – undo
33 33
         $mail->setBCC('[email protected]');
34 34
 
35 35
         $queue->expects('push')->withArgs(
36
-            function ($job, $data, Options $options) use ($mail) {
36
+            function ($job, $data, Options $options) use ($mail)
37
+            {
37 38
                 $this->assertSame(MailQueue::JOB_NAME, $job);
38 39
                 $this->assertSame($data, MessageSerializer::pack($mail));
39 40
                 $this->assertSame('mailer', $options->getQueue());
Please login to merge, or discard this patch.
src/SendIt/src/Renderer/ViewRenderer.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public function __construct(
17 17
         private readonly ViewsInterface $views
18
-    ) {
18
+    ){
19 19
     }
20 20
 
21 21
     public function render(MessageInterface $message): Email
22 22
     {
23
-        try {
23
+        try{
24 24
             $view = $this->views->get($message->getSubject());
25
-        } catch (ViewException $e) {
25
+        }catch (ViewException $e){
26 26
             throw new MailerException(
27 27
                 \sprintf('Invalid email template `%s`: %s', $message->getSubject(), $e->getMessage()),
28 28
                 $e->getCode(),
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
         $msg = new Email();
34 34
 
35
-        if ($message->getFrom() !== null) {
35
+        if ($message->getFrom() !== null){
36 36
             $msg->from($message->getFrom());
37 37
         }
38 38
 
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
         $msg->cc(...$message->getCC());
41 41
         $msg->bcc(...$message->getBCC());
42 42
 
43
-        try {
43
+        try{
44 44
             // render message partials
45 45
             $view->render(\array_merge(['_msg_' => $msg], $message->getData()));
46
-        } catch (ViewException $e) {
46
+        }catch (ViewException $e){
47 47
             throw new MailerException(
48 48
                 \sprintf('Unable to render email `%s`: %s', $message->getSubject(), $e->getMessage()),
49 49
                 $e->getCode(),
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public static function escapeSubject(string $subject): string
65 65
     {
66
-        if (!preg_match('/[^\x20-\x7e]/', $subject)) {
66
+        if (!preg_match('/[^\x20-\x7e]/', $subject)){
67 67
             // ascii-only subject, return as-is
68 68
             return $subject;
69 69
         }
@@ -73,6 +73,6 @@  discard block
 block discarded – undo
73 73
         $prefix = '=?UTF-8?B?';
74 74
         $suffix = '?=';
75 75
 
76
-        return $prefix . \str_replace("=\r\n", $suffix . "\r\n  " . $prefix, $encoded) . $suffix;
76
+        return $prefix.\str_replace("=\r\n", $suffix."\r\n  ".$prefix, $encoded).$suffix;
77 77
     }
78 78
 }
Please login to merge, or discard this patch.
Braces   +14 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,9 +20,12 @@  discard block
 block discarded – undo
20 20
 
21 21
     public function render(MessageInterface $message): Email
22 22
     {
23
-        try {
23
+        try
24
+        {
24 25
             $view = $this->views->get($message->getSubject());
25
-        } catch (ViewException $e) {
26
+        }
27
+        catch (ViewException $e)
28
+        {
26 29
             throw new MailerException(
27 30
                 \sprintf('Invalid email template `%s`: %s', $message->getSubject(), $e->getMessage()),
28 31
                 $e->getCode(),
@@ -32,7 +35,8 @@  discard block
 block discarded – undo
32 35
 
33 36
         $msg = new Email();
34 37
 
35
-        if ($message->getFrom() !== null) {
38
+        if ($message->getFrom() !== null)
39
+        {
36 40
             $msg->from($message->getFrom());
37 41
         }
38 42
 
@@ -40,10 +44,13 @@  discard block
 block discarded – undo
40 44
         $msg->cc(...$message->getCC());
41 45
         $msg->bcc(...$message->getBCC());
42 46
 
43
-        try {
47
+        try
48
+        {
44 49
             // render message partials
45 50
             $view->render(\array_merge(['_msg_' => $msg], $message->getData()));
46
-        } catch (ViewException $e) {
51
+        }
52
+        catch (ViewException $e)
53
+        {
47 54
             throw new MailerException(
48 55
                 \sprintf('Unable to render email `%s`: %s', $message->getSubject(), $e->getMessage()),
49 56
                 $e->getCode(),
@@ -63,7 +70,8 @@  discard block
 block discarded – undo
63 70
      */
64 71
     public static function escapeSubject(string $subject): string
65 72
     {
66
-        if (!preg_match('/[^\x20-\x7e]/', $subject)) {
73
+        if (!preg_match('/[^\x20-\x7e]/', $subject))
74
+        {
67 75
             // ascii-only subject, return as-is
68 76
             return $subject;
69 77
         }
Please login to merge, or discard this patch.
src/SendIt/src/Config/MailerConfig.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
             'queue' => null,
18 18
             'queueConnection' => null,
19 19
         ]
20
-    ) {
20
+    ){
21 21
         parent::__construct($config);
22 22
     }
23 23
 
Please login to merge, or discard this patch.
src/SendIt/src/MailQueue.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@
 block discarded – undo
17 17
     public function __construct(
18 18
         private readonly MailerConfig $config,
19 19
         private readonly QueueInterface $queue
20
-    ) {
20
+    ){
21 21
     }
22 22
 
23 23
     public function send(MessageInterface ...$message): void
24 24
     {
25 25
         $options = Options::onQueue($this->config->getQueue());
26 26
 
27
-        foreach ($message as $msg) {
27
+        foreach ($message as $msg){
28 28
             $this->queue->push(
29 29
                 self::JOB_NAME,
30 30
                 MessageSerializer::pack($msg),
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,8 @@
 block discarded – undo
24 24
     {
25 25
         $options = Options::onQueue($this->config->getQueue());
26 26
 
27
-        foreach ($message as $msg) {
27
+        foreach ($message as $msg)
28
+        {
28 29
             $this->queue->push(
29 30
                 self::JOB_NAME,
30 31
                 MessageSerializer::pack($msg),
Please login to merge, or discard this patch.
src/SendIt/src/Event/MessageSent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,6 +10,6 @@
 block discarded – undo
10 10
 {
11 11
     public function __construct(
12 12
         public readonly Email $message
13
-    ) {
13
+    ){
14 14
     }
15 15
 }
Please login to merge, or discard this patch.
src/SendIt/src/Event/MessageNotSent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,6 +11,6 @@
 block discarded – undo
11 11
     public function __construct(
12 12
         public readonly Email $message,
13 13
         public readonly \Throwable $exception
14
-    ) {
14
+    ){
15 15
     }
16 16
 }
Please login to merge, or discard this patch.