Skip to content

Commit 5d8f912

Browse files
committed
Apply styles
1 parent 67b7786 commit 5d8f912

File tree

5 files changed

+88
-81
lines changed

5 files changed

+88
-81
lines changed

src/Entities/Attachment.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
class Attachment extends Entity
66
{
77
protected $table = 'outbox_attachments';
8-
protected $casts = [
9-
'outbox_email_id' => 'int',
10-
'bytes' => 'int',
11-
];
8+
protected $casts = [
9+
'outbox_email_id' => 'int',
10+
'bytes' => 'int',
11+
];
1212
}

src/Entities/Email.php

Lines changed: 63 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -5,75 +5,78 @@
55
class Email extends Entity
66
{
77
protected $table = 'outbox_emails';
8-
protected $dates = ['created_at', 'updated_at'];
8+
protected $dates = [
9+
'created_at',
10+
'updated_at',
11+
];
912

10-
/**
11-
* Array of field names and the type of value to cast them as
12-
* when they are accessed.
13-
*/
14-
protected $casts = [
15-
'priority' => 'int',
16-
'sendMultipart' => 'boolean',
17-
'BCCBatchMode' => 'boolean',
18-
'BCCBatchSize' => 'int',
19-
];
13+
/**
14+
* Array of field names and the type of value to cast them as
15+
* when they are accessed.
16+
*/
17+
protected $casts = [
18+
'priority' => 'int',
19+
'sendMultipart' => 'boolean',
20+
'BCCBatchMode' => 'boolean',
21+
'BCCBatchSize' => 'int',
22+
];
2023

21-
/**
22-
* Attachments cache
23-
*
24-
* @var array|null
25-
*/
26-
protected $attachments;
24+
/**
25+
* Attachments cache
26+
*
27+
* @var array|null
28+
*/
29+
protected $attachments;
2730

28-
/**
29-
* Recipients cache
30-
*
31-
* @var array|null
32-
*/
33-
protected $recipients;
31+
/**
32+
* Recipients cache
33+
*
34+
* @var array|null
35+
*/
36+
protected $recipients;
3437

35-
/**
36-
* Returns this email's attachments.
37-
*
38-
* @return array
39-
*/
40-
public function getAttachments(): array
41-
{
42-
return $this->getRelatedItems('attachment');
43-
}
38+
/**
39+
* Returns this email's attachments.
40+
*
41+
* @return array
42+
*/
43+
public function getAttachments(): array
44+
{
45+
return $this->getRelatedItems('attachment');
46+
}
4447

45-
/**
46-
* Returns this email's recipients.
47-
*
48-
* @return array
49-
*/
50-
public function getRecipients(): array
51-
{
52-
return $this->getRelatedItems('recipient');
53-
}
48+
/**
49+
* Returns this email's recipients.
50+
*
51+
* @return array
52+
*/
53+
public function getRecipients(): array
54+
{
55+
return $this->getRelatedItems('recipient');
56+
}
5457

55-
/**
56-
* Helper function to return attachments or recipients.
57-
*
58-
* @param string $target Object/table/model to request
59-
*
60-
* @return array
61-
*/
62-
protected function getRelatedItems(string $target): array
63-
{
64-
if (empty($this->id))
65-
{
66-
throw new \RuntimeException('Object must be created before getting relations.');
67-
}
58+
/**
59+
* Helper function to return attachments or recipients.
60+
*
61+
* @param string $target Object/table/model to request
62+
*
63+
* @return array
64+
*/
65+
protected function getRelatedItems(string $target): array
66+
{
67+
if (empty($this->id))
68+
{
69+
throw new \RuntimeException('Object must be created before getting relations.');
70+
}
6871

6972
$property = $target . 's';
7073
$model = 'Tatter\Outbox\Models\\' . ucfirst($target) . 'Model';
7174

72-
if (is_null($this->$property))
73-
{
74-
$this->$property = model($model)->where('outbox_email_id', $this->id)->findAll();
75-
}
75+
if (is_null($this->$property))
76+
{
77+
$this->$property = model($model)->where('outbox_email_id', $this->id)->findAll();
78+
}
7679

77-
return $this->$property;
78-
}
80+
return $this->$property;
81+
}
7982
}

src/Entities/Recipient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
class Recipient extends Entity
66
{
77
protected $table = 'outbox_recipients';
8-
protected $casts = ['outbox_email_id' => 'int'];
8+
protected $casts = ['outbox_email_id' => 'int'];
99
}

src/Entities/Template.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
class Template extends Entity
99
{
1010
protected $table = 'outbox_templates';
11-
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
12-
protected $casts = [
13-
'parent_id' => '?int',
14-
];
11+
protected $dates = [
12+
'created_at',
13+
'updated_at',
14+
'deleted_at',
15+
];
16+
protected $casts = [
17+
'parent_id' => '?int',
18+
];
1519

1620
/**
1721
* Stored parent Template.
@@ -81,7 +85,7 @@ public function getTokens(): array
8185
/**
8286
* Renders the body with inlined CSS.
8387
*
84-
* @param array $data Variables to exchange for Template tokens
88+
* @param array $data Variables to exchange for Template tokens
8589
* @param string|null $styles CSS to use for inlining, defaults to configured view
8690
*
8791
* @return string
@@ -137,15 +141,15 @@ public function renderSubject($data = []): string
137141
/**
138142
* Returns an Email instance primed to this Template's rendered values.
139143
*
140-
* @param array $data Variables to use when rendering the body
144+
* @param array $data Variables to use when rendering the body
141145
* @param string|null $styles CSS to use for inlining, null to use configured view
142146
*
143147
* @return Email
144148
*/
145149
public function email($data = [], string $styles = null): Email
146150
{
147151
// Start with the default config and add necessary settings
148-
$email = service('email');
152+
$email = service('email');
149153
$email->mailType = 'html';
150154
$email->wordWrap = false;
151155

tests/_support/DatabaseTestCase.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class DatabaseTestCase extends CIDatabaseTestCase
3030
*
3131
* @var string|array|null
3232
*/
33-
protected $namespace = 'Tatter\Outbox';
33+
protected $namespace = 'Tatter\Outbox';
3434

3535
/**
3636
* Path to a file for attachments.
@@ -46,17 +46,17 @@ class DatabaseTestCase extends CIDatabaseTestCase
4646
*/
4747
protected $email;
4848

49-
/**
50-
* Initializes the Test Helper.
51-
*/
52-
public static function setUpBeforeClass(): void
53-
{
54-
helper('test');
49+
/**
50+
* Initializes the Test Helper.
51+
*/
52+
public static function setUpBeforeClass(): void
53+
{
54+
helper('test');
5555
self::$faker = Factory::create();
5656

5757
// Globally mock Email so nothing really sends
58-
Services::injectMock('email', new MockEmail(config('Email')));
59-
}
58+
Services::injectMock('email', new MockEmail(config('Email')));
59+
}
6060

6161
public function setUp(): void
6262
{

0 commit comments

Comments
 (0)