Passed
Push — master ( 95fdf8...1b835e )
by Kirill
04:44 queued 10s
created
src/SendIt/src/MailJob.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
 
57 57
         $email = $this->renderer->render($message);
58 58
 
59
-        if ($email->getFrom() === []) {
59
+        if ($email->getFrom() === []){
60 60
             $email->from(Address::fromString($this->config->getFromAddress()));
61 61
         }
62 62
 
63 63
         $recipients = $this->getRecipients($email);
64 64
 
65
-        try {
65
+        try{
66 66
             $this->mailer->send($email);
67
-        } catch (TransportExceptionInterface $e) {
67
+        }catch (TransportExceptionInterface $e){
68 68
             $this->getLogger()->error(
69 69
                 sprintf(
70 70
                     'Failed to send `%s` to "%s": %s',
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
         $addresses = array_merge($message->getTo(), $message->getCc(), $message->getBcc());
100 100
 
101
-        foreach ($addresses as $address) {
101
+        foreach ($addresses as $address){
102 102
             $emails[] = $address->toString();
103 103
         }
104 104
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,15 +56,19 @@  discard block
 block discarded – undo
56 56
 
57 57
         $email = $this->renderer->render($message);
58 58
 
59
-        if ($email->getFrom() === []) {
59
+        if ($email->getFrom() === [])
60
+        {
60 61
             $email->from(Address::fromString($this->config->getFromAddress()));
61 62
         }
62 63
 
63 64
         $recipients = $this->getRecipients($email);
64 65
 
65
-        try {
66
+        try
67
+        {
66 68
             $this->mailer->send($email);
67
-        } catch (TransportExceptionInterface $e) {
69
+        }
70
+        catch (TransportExceptionInterface $e)
71
+        {
68 72
             $this->getLogger()->error(
69 73
                 sprintf(
70 74
                     'Failed to send `%s` to "%s": %s',
@@ -98,7 +102,8 @@  discard block
 block discarded – undo
98 102
 
99 103
         $addresses = array_merge($message->getTo(), $message->getCc(), $message->getBcc());
100 104
 
101
-        foreach ($addresses as $address) {
105
+        foreach ($addresses as $address)
106
+        {
102 107
             $emails[] = $address->toString();
103 108
         }
104 109
 
Please login to merge, or discard this patch.
src/SendIt/src/MessageSerializer.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,11 +51,11 @@
 block discarded – undo
51 51
     public static function unpack(array $payload): MessageInterface
52 52
     {
53 53
         $message = new Message($payload['subject'], $payload['to'], $payload['data']);
54
-        if ($payload['from'] !== null) {
54
+        if ($payload['from'] !== null){
55 55
             $message->setFrom($payload['from']);
56 56
         }
57 57
 
58
-        if ($payload['replyTo'] !== null) {
58
+        if ($payload['replyTo'] !== null){
59 59
             $message->setReplyTo($payload['replyTo']);
60 60
         }
61 61
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,11 +51,13 @@
 block discarded – undo
51 51
     public static function unpack(array $payload): MessageInterface
52 52
     {
53 53
         $message = new Message($payload['subject'], $payload['to'], $payload['data']);
54
-        if ($payload['from'] !== null) {
54
+        if ($payload['from'] !== null)
55
+        {
55 56
             $message->setFrom($payload['from']);
56 57
         }
57 58
 
58
-        if ($payload['replyTo'] !== null) {
59
+        if ($payload['replyTo'] !== null)
60
+        {
59 61
             $message->setReplyTo($payload['replyTo']);
60 62
         }
61 63
 
Please login to merge, or discard this patch.
src/SendIt/src/Renderer/ViewRenderer.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function render(MessageInterface $message): Email
39 39
     {
40
-        try {
40
+        try{
41 41
             $view = $this->views->get($message->getSubject());
42
-        } catch (ViewException $e) {
42
+        }catch (ViewException $e){
43 43
             throw new MailerException(
44 44
                 sprintf('Invalid email template `%s`: %s', $message->getSubject(), $e->getMessage()),
45 45
                 $e->getCode(),
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
         $msg = new Email();
51 51
 
52
-        if ($message->getFrom() !== null) {
52
+        if ($message->getFrom() !== null){
53 53
             $msg->from([$message->getFrom()]);
54 54
         }
55 55
 
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
         $msg->cc(...$message->getCC());
58 58
         $msg->bcc(...$message->getBCC());
59 59
 
60
-        try {
60
+        try{
61 61
             // render message partials
62 62
             $view->render(array_merge(['_msg_' => $msg], $message->getData()));
63
-        } catch (ViewException $e) {
63
+        }catch (ViewException $e){
64 64
             throw new MailerException(
65 65
                 sprintf('Unable to render email `%s`: %s', $message->getSubject(), $e->getMessage()),
66 66
                 $e->getCode(),
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public static function escapeSubject(string $subject): string
82 82
     {
83
-        if (!preg_match('/[^\x20-\x7e]/', $subject)) {
83
+        if (!preg_match('/[^\x20-\x7e]/', $subject)){
84 84
             // ascii-only subject, return as-is
85 85
             return $subject;
86 86
         }
@@ -90,6 +90,6 @@  discard block
 block discarded – undo
90 90
         $prefix = '=?UTF-8?q?';
91 91
         $suffix = '?=';
92 92
 
93
-        return $prefix . str_replace("=\r\n", $suffix . "\r\n  " . $prefix, $encoded) . $suffix;
93
+        return $prefix.str_replace("=\r\n", $suffix."\r\n  ".$prefix, $encoded).$suffix;
94 94
     }
95 95
 }
Please login to merge, or discard this patch.
Braces   +14 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,9 +37,12 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function render(MessageInterface $message): Email
39 39
     {
40
-        try {
40
+        try
41
+        {
41 42
             $view = $this->views->get($message->getSubject());
42
-        } catch (ViewException $e) {
43
+        }
44
+        catch (ViewException $e)
45
+        {
43 46
             throw new MailerException(
44 47
                 sprintf('Invalid email template `%s`: %s', $message->getSubject(), $e->getMessage()),
45 48
                 $e->getCode(),
@@ -49,7 +52,8 @@  discard block
 block discarded – undo
49 52
 
50 53
         $msg = new Email();
51 54
 
52
-        if ($message->getFrom() !== null) {
55
+        if ($message->getFrom() !== null)
56
+        {
53 57
             $msg->from([$message->getFrom()]);
54 58
         }
55 59
 
@@ -57,10 +61,13 @@  discard block
 block discarded – undo
57 61
         $msg->cc(...$message->getCC());
58 62
         $msg->bcc(...$message->getBCC());
59 63
 
60
-        try {
64
+        try
65
+        {
61 66
             // render message partials
62 67
             $view->render(array_merge(['_msg_' => $msg], $message->getData()));
63
-        } catch (ViewException $e) {
68
+        }
69
+        catch (ViewException $e)
70
+        {
64 71
             throw new MailerException(
65 72
                 sprintf('Unable to render email `%s`: %s', $message->getSubject(), $e->getMessage()),
66 73
                 $e->getCode(),
@@ -80,7 +87,8 @@  discard block
 block discarded – undo
80 87
      */
81 88
     public static function escapeSubject(string $subject): string
82 89
     {
83
-        if (!preg_match('/[^\x20-\x7e]/', $subject)) {
90
+        if (!preg_match('/[^\x20-\x7e]/', $subject))
91
+        {
84 92
             // ascii-only subject, return as-is
85 93
             return $subject;
86 94
         }
Please login to merge, or discard this patch.
src/SendIt/src/Bootloader/BuilderBootloader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,6 +35,6 @@
 block discarded – undo
35 35
      */
36 36
     public function boot(ViewsBootloader $views): void
37 37
     {
38
-        $views->addDirectory('sendit', __DIR__ . '/../../views');
38
+        $views->addDirectory('sendit', __DIR__.'/../../views');
39 39
     }
40 40
 }
Please login to merge, or discard this patch.
src/SendIt/src/MailQueue.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
      */
43 43
     public function send(MessageInterface ...$message): void
44 44
     {
45
-        foreach ($message as $msg) {
45
+        foreach ($message as $msg){
46 46
             $this->queue->push(
47 47
                 self::JOB_NAME,
48 48
                 MessageSerializer::pack($msg),
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
     public function send(MessageInterface ...$message): void
44 44
     {
45
-        foreach ($message as $msg) {
45
+        foreach ($message as $msg)
46
+        {
46 47
             $this->queue->push(
47 48
                 self::JOB_NAME,
48 49
                 MessageSerializer::pack($msg),
Please login to merge, or discard this patch.
src/SendIt/tests/JobTest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $email->to('[email protected]');
50 50
         $email->html('message body');
51 51
 
52
-        $renderer->expects('render')->withArgs(function (Message $message) {
52
+        $renderer->expects('render')->withArgs(function (Message $message){
53 53
             $this->assertSame($message->getSubject(), 'test');
54 54
             return true;
55 55
         })->andReturn($email);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         $email->to('[email protected]');
92 92
         $email->html('message body');
93 93
 
94
-        $renderer->expects('render')->withArgs(function (Message $message) {
94
+        $renderer->expects('render')->withArgs(function (Message $message){
95 95
             $this->assertSame($message->getSubject(), 'test');
96 96
             return true;
97 97
         })->andReturn($email);
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
             ['emails' => ['[email protected]']]
104 104
         );
105 105
 
106
-        try {
106
+        try{
107 107
             $handler->handle(
108 108
                 MailQueue::JOB_NAME,
109 109
                 'id',
110 110
                 json_encode(MessageSerializer::pack($mail))
111 111
             );
112
-        } catch (TransportException $e) {
112
+        }catch (TransportException $e){
113 113
         }
114 114
 
115 115
         $logger->mockery_verify();
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,7 +49,8 @@  discard block
 block discarded – undo
49 49
         $email->to('[email protected]');
50 50
         $email->html('message body');
51 51
 
52
-        $renderer->expects('render')->withArgs(function (Message $message) {
52
+        $renderer->expects('render')->withArgs(function (Message $message)
53
+        {
53 54
             $this->assertSame($message->getSubject(), 'test');
54 55
             return true;
55 56
         })->andReturn($email);
@@ -91,7 +92,8 @@  discard block
 block discarded – undo
91 92
         $email->to('[email protected]');
92 93
         $email->html('message body');
93 94
 
94
-        $renderer->expects('render')->withArgs(function (Message $message) {
95
+        $renderer->expects('render')->withArgs(function (Message $message)
96
+        {
95 97
             $this->assertSame($message->getSubject(), 'test');
96 98
             return true;
97 99
         })->andReturn($email);
@@ -103,13 +105,16 @@  discard block
 block discarded – undo
103 105
             ['emails' => ['[email protected]']]
104 106
         );
105 107
 
106
-        try {
108
+        try
109
+        {
107 110
             $handler->handle(
108 111
                 MailQueue::JOB_NAME,
109 112
                 'id',
110 113
                 json_encode(MessageSerializer::pack($mail))
111 114
             );
112
-        } catch (TransportException $e) {
115
+        }
116
+        catch (TransportException $e)
117
+        {
113 118
         }
114 119
 
115 120
         $logger->mockery_verify();
Please login to merge, or discard this patch.
src/SendIt/tests/RenderTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@
 block discarded – undo
26 26
     public function setUp(): void
27 27
     {
28 28
         $this->app = App::init([
29
-            'root' => __DIR__ . '/App',
30
-            'app'  => __DIR__ . '/App'
29
+            'root' => __DIR__.'/App',
30
+            'app'  => __DIR__.'/App'
31 31
         ]);
32 32
     }
33 33
 
Please login to merge, or discard this patch.
src/SendIt/tests/QueueTest.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,8 @@
 block discarded – undo
37 37
         $mail->setBCC('[email protected]');
38 38
 
39 39
         $queue->expects('push')->withArgs(
40
-            function ($job, $data, Options $options) use ($mail) {
40
+            function ($job, $data, Options $options) use ($mail)
41
+            {
41 42
                 $this->assertSame(MailQueue::JOB_NAME, $job);
42 43
                 $this->assertSame($data, MessageSerializer::pack($mail));
43 44
                 $this->assertSame('mailer', $options->getPipeline());
Please login to merge, or discard this patch.
src/SendIt/views/builder.dark.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 $_msg_->subject(\Spiral\SendIt\Renderer\ViewRenderer::escapeSubject(inject('subject')));
9 9
 
10
-if (injected('from')) {
10
+if (injected('from')){
11 11
     $_msg_->from(\Symfony\Component\Mime\Address::fromString(inject('from')));
12 12
 }
13 13
 
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 
20 20
 ob_start(); ?>${html}<?php $_html_ = ob_get_clean();
21 21
 
22
-if (!empty($_html_)) {
22
+if (!empty($_html_)){
23 23
     $_msg_->html($_html_);
24 24
 }
25 25
 
26 26
 ob_start(); ?>${text}<?php $_text_ = ob_get_clean();
27 27
 
28
-if (!empty($_text_)) {
28
+if (!empty($_text_)){
29 29
     $_msg_->text($_text_);
30 30
 }
31 31
 ?>
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,8 @@  discard block
 block discarded – undo
7 7
  */
8 8
 $_msg_->subject(\Spiral\SendIt\Renderer\ViewRenderer::escapeSubject(inject('subject')));
9 9
 
10
-if (injected('from')) {
10
+if (injected('from'))
11
+{
11 12
     $_msg_->from(\Symfony\Component\Mime\Address::fromString(inject('from')));
12 13
 }
13 14
 
@@ -19,13 +20,15 @@  discard block
 block discarded – undo
19 20
 
20 21
 ob_start(); ?>${html}<?php $_html_ = ob_get_clean();
21 22
 
22
-if (!empty($_html_)) {
23
+if (!empty($_html_))
24
+{
23 25
     $_msg_->html($_html_);
24 26
 }
25 27
 
26 28
 ob_start(); ?>${text}<?php $_text_ = ob_get_clean();
27 29
 
28
-if (!empty($_text_)) {
30
+if (!empty($_text_))
31
+{
29 32
     $_msg_->text($_text_);
30 33
 }
31 34
 ?>
Please login to merge, or discard this patch.