Completed
Push — master ( dd0453...7030c1 )
by Edgar
02:30
created
src/Inbounder/Parsers/Objects/Object.php 3 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -7,47 +7,47 @@
 block discarded – undo
7 7
 
8 8
 class Object implements Arrayable
9 9
 {
10
-    /**
11
-     * Attributes
12
-     */
13
-    protected $attributes = array();
10
+	/**
11
+	 * Attributes
12
+	 */
13
+	protected $attributes = array();
14 14
 
15
-    /**
16
-     * Constructor
17
-     */
18
-    public function __construct($email, $name = null, $mailboxHash = null)
19
-    {
20
-        $this->attributes['email'] = $email;
21
-        $this->attributes['name'] = $name;
22
-        $this->attributes['mailboxHash'] = $mailboxHash;
23
-    }
15
+	/**
16
+	 * Constructor
17
+	 */
18
+	public function __construct($email, $name = null, $mailboxHash = null)
19
+	{
20
+		$this->attributes['email'] = $email;
21
+		$this->attributes['name'] = $name;
22
+		$this->attributes['mailboxHash'] = $mailboxHash;
23
+	}
24 24
 
25
-    /**
26
-     * Setter
27
-     */
28
-    public function __set($name, $value)
29
-    {
30
-        $this->attributes[$name] = $value;
31
-    }
25
+	/**
26
+	 * Setter
27
+	 */
28
+	public function __set($name, $value)
29
+	{
30
+		$this->attributes[$name] = $value;
31
+	}
32 32
 
33
-    /**
34
-     * Getter
35
-     */
36
-    public function __get($name)
37
-    {
38
-        if ( ! array_key_exists($name, $this->attributes))
39
-            throw new MissingAttributeException("The attribute $name does not exists.", 1);
33
+	/**
34
+	 * Getter
35
+	 */
36
+	public function __get($name)
37
+	{
38
+		if ( ! array_key_exists($name, $this->attributes))
39
+			throw new MissingAttributeException("The attribute $name does not exists.", 1);
40 40
             
41
-        return $this->attributes[$name];
42
-    }
41
+		return $this->attributes[$name];
42
+	}
43 43
 
44
-    /**
45
-     * Get the instance as an array.
46
-     *
47
-     * @return array
48
-     */
49
-    public function toArray()
50
-    {
51
-        return $this->attributes;
52
-    }
44
+	/**
45
+	 * Get the instance as an array.
46
+	 *
47
+	 * @return array
48
+	 */
49
+	public function toArray()
50
+	{
51
+		return $this->attributes;
52
+	}
53 53
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
      */
18 18
     public function __construct($email, $name = null, $mailboxHash = null)
19 19
     {
20
-        $this->attributes['email'] = $email;
21
-        $this->attributes['name'] = $name;
22
-        $this->attributes['mailboxHash'] = $mailboxHash;
20
+        $this->attributes[ 'email' ] = $email;
21
+        $this->attributes[ 'name' ] = $name;
22
+        $this->attributes[ 'mailboxHash' ] = $mailboxHash;
23 23
     }
24 24
 
25 25
     /**
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function __set($name, $value)
29 29
     {
30
-        $this->attributes[$name] = $value;
30
+        $this->attributes[ $name ] = $value;
31 31
     }
32 32
 
33 33
     /**
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function __get($name)
37 37
     {
38
-        if ( ! array_key_exists($name, $this->attributes))
38
+        if (!array_key_exists($name, $this->attributes))
39 39
             throw new MissingAttributeException("The attribute $name does not exists.", 1);
40 40
             
41
-        return $this->attributes[$name];
41
+        return $this->attributes[ $name ];
42 42
     }
43 43
 
44 44
     /**
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,9 @@
 block discarded – undo
35 35
      */
36 36
     public function __get($name)
37 37
     {
38
-        if ( ! array_key_exists($name, $this->attributes))
39
-            throw new MissingAttributeException("The attribute $name does not exists.", 1);
38
+        if ( ! array_key_exists($name, $this->attributes)) {
39
+                    throw new MissingAttributeException("The attribute $name does not exists.", 1);
40
+        }
40 41
             
41 42
         return $this->attributes[$name];
42 43
     }
Please login to merge, or discard this patch.
src/Inbounder/Parsers/PostmarkappParser.php 3 patches
Indentation   +235 added lines, -235 removed lines patch added patch discarded remove patch
@@ -11,239 +11,239 @@
 block discarded – undo
11 11
 
12 12
 class PostmarkappParser extends AbstractParser implements EmailParserInterface
13 13
 {
14
-    /**
15
-     * Parse the request and return itself
16
-     * 
17
-     * @return ParserInterface
18
-     */
19
-    public function parse() : ParserInterface
20
-    {
21
-        $this->from = $this->from();
22
-        $this->replyTo = $this->replyTo();
23
-
24
-        $this->to = $this->to();
25
-        $this->cc = $this->cc();
26
-        $this->bcc = $this->bcc();
27
-
28
-        $this->subject = $this->subject();
29
-        $this->body = $this->body();
30
-
31
-        $this->attachements = $this->attachements();
32
-
33
-        return $this;
34
-    }
35
-
36
-    /**
37
-     * Return an Address object from an input
38
-     * 
39
-     * @param Array $input
40
-     * @return Address
41
-     */
42
-    protected function address(Array $input) : Address
43
-    {
44
-        return new Address($input['Email'], $input['Name'], $input['MailboxHash']);
45
-    }
46
-
47
-    /**
48
-     * Parse an array of addresses
49
-     * 
50
-     * @param Array $input
51
-     * @return Collection
52
-     */
53
-    protected function foreachAddress(Array $input) : Collection
54
-    {
55
-        $collection = new Collection;
56
-
57
-        foreach ($input as $address)
58
-            $collection->push($this->address($address));
59
-
60
-        return $collection;
61
-    }
62
-
63
-    /**
64
-     * From property
65
-     * 
66
-     * @return Address
67
-     */
68
-    public function from() : Address
69
-    {
70
-        return $this->address($this->input('FromFull'));
71
-    }
72
-
73
-    /**
74
-     * Reply-to property
75
-     * 
76
-     * @todo: edit this to handler the reply-to parameter
77
-     * 
78
-     * @return Address
79
-     */
80
-    public function replyTo() : Address
81
-    {
82
-        return $this->address($this->input('FromFull'));
83
-    }
84
-
85
-    /**
86
-     * To property
87
-     * 
88
-     * @return Collection<Address>
89
-     */
90
-    public function to() : Collection
91
-    {
92
-        return $this->foreachAddress($this->input('ToFull'));
93
-    }
94
-
95
-    /**
96
-     * CC property
97
-     * 
98
-     * @return Collection<Address>
99
-     */
100
-    public function cc() : Collection
101
-    {
102
-        return $this->foreachAddress($this->input('CcFull'));
103
-    }
104
-
105
-    /**
106
-     * BCC property
107
-     * 
108
-     * @return Collection<Address>
109
-     */
110
-    public function bcc() : Collection
111
-    {
112
-        return $this->foreachAddress($this->input('BccFull'));
113
-    }
114
-
115
-    /**
116
-     * Subject property
117
-     * 
118
-     * @return String
119
-     */
120
-    public function subject()
121
-    {
122
-        return $this->input('Subject');
123
-    }
124
-
125
-    /**
126
-     * Body
127
-     * 
128
-     * @return String
129
-     */
130
-    public function body()
131
-    {
132
-        $body = $this->bodyHtml();
133
-
134
-        if ($this->bodyIsText())
135
-            $body = $this->bodyText();
136
-
137
-        return $body;
138
-    }
139
-
140
-    /**
141
-     * Return the body html
142
-     * 
143
-     * @return String
144
-     */
145
-    public function bodyHtml()
146
-    {
147
-        return $this->input('HtmlBody');
148
-    }
149
-
150
-    /**
151
-     * Return the body text
152
-     * 
153
-     * @return String
154
-     */
155
-    public function bodyText()
156
-    {
157
-        return $this->input('TextBody');
158
-    }
159
-
160
-    /**
161
-     * IsText
162
-     * 
163
-     * @return Boolean
164
-     */
165
-    public function bodyIsText()
166
-    {
167
-        return ! $this->bodyIsHtml();
168
-    }
169
-
170
-    /**
171
-     * IsHtml
172
-     * 
173
-     * @return Boolean
174
-     */
175
-    public function bodyIsHtml()
176
-    {
177
-        return ! is_null($this->input('HtmlBody')) || $this->input('HtmlBody') !== '';
178
-    }
179
-
180
-    /**
181
-     * Get email headers
182
-     * 
183
-     * @return Collection
184
-     */
185
-    public function headers() : Collection
186
-    {
187
-        $collection = new Collection;
188
-
189
-        foreach ($this->input('Headers') as $header)
190
-            $collection->push(new Header($header['Name'], $header['Value']));
191
-
192
-        return $collection;
193
-    }
194
-
195
-    /**
196
-     * retrieve a email header
197
-     * 
198
-     * return Array
199
-     */
200
-    public function header($name) : Header
201
-    {
202
-        return $this->headers()->filter(function ($header) use ($name) {
203
-            return $header->name === $name;
204
-        })->first();
205
-    }
206
-
207
-    /**
208
-     * Determinate if the email is marked as spam
209
-     * 
210
-     * @return Boolean
211
-     */
212
-    public function isSpam()
213
-    {
214
-        $header = $this->header('X-Spam-Flag');
215
-        return $header->value === 'NO' ? false : true;
216
-    }
217
-
218
-    /**
219
-     * Has attachements
220
-     * 
221
-     * @return Boolean
222
-     */
223
-    public function hasAttachements()
224
-    {
225
-        return $this->attachements->isEmpty();
226
-    }
227
-
228
-    /**
229
-     * Attachments
230
-     * 
231
-     * @return Collection<File>
232
-     */
233
-    public function attachements() : Collection
234
-    {
235
-        $collection = new Collection;
236
-
237
-        foreach ($this->input('Attachments') as $attachment)
238
-            $collection->push(
239
-                new Attachment(
240
-                    $attachment['Name'],
241
-                    ( isset($attachment['Content']) ? $attachment['Content'] : '' ),
242
-                    $attachment['ContentType'],
243
-                    $attachment['ContentLength']
244
-                )
245
-            );
246
-
247
-        return $collection;
248
-    }
14
+	/**
15
+	 * Parse the request and return itself
16
+	 * 
17
+	 * @return ParserInterface
18
+	 */
19
+	public function parse() : ParserInterface
20
+	{
21
+		$this->from = $this->from();
22
+		$this->replyTo = $this->replyTo();
23
+
24
+		$this->to = $this->to();
25
+		$this->cc = $this->cc();
26
+		$this->bcc = $this->bcc();
27
+
28
+		$this->subject = $this->subject();
29
+		$this->body = $this->body();
30
+
31
+		$this->attachements = $this->attachements();
32
+
33
+		return $this;
34
+	}
35
+
36
+	/**
37
+	 * Return an Address object from an input
38
+	 * 
39
+	 * @param Array $input
40
+	 * @return Address
41
+	 */
42
+	protected function address(Array $input) : Address
43
+	{
44
+		return new Address($input['Email'], $input['Name'], $input['MailboxHash']);
45
+	}
46
+
47
+	/**
48
+	 * Parse an array of addresses
49
+	 * 
50
+	 * @param Array $input
51
+	 * @return Collection
52
+	 */
53
+	protected function foreachAddress(Array $input) : Collection
54
+	{
55
+		$collection = new Collection;
56
+
57
+		foreach ($input as $address)
58
+			$collection->push($this->address($address));
59
+
60
+		return $collection;
61
+	}
62
+
63
+	/**
64
+	 * From property
65
+	 * 
66
+	 * @return Address
67
+	 */
68
+	public function from() : Address
69
+	{
70
+		return $this->address($this->input('FromFull'));
71
+	}
72
+
73
+	/**
74
+	 * Reply-to property
75
+	 * 
76
+	 * @todo: edit this to handler the reply-to parameter
77
+	 * 
78
+	 * @return Address
79
+	 */
80
+	public function replyTo() : Address
81
+	{
82
+		return $this->address($this->input('FromFull'));
83
+	}
84
+
85
+	/**
86
+	 * To property
87
+	 * 
88
+	 * @return Collection<Address>
89
+	 */
90
+	public function to() : Collection
91
+	{
92
+		return $this->foreachAddress($this->input('ToFull'));
93
+	}
94
+
95
+	/**
96
+	 * CC property
97
+	 * 
98
+	 * @return Collection<Address>
99
+	 */
100
+	public function cc() : Collection
101
+	{
102
+		return $this->foreachAddress($this->input('CcFull'));
103
+	}
104
+
105
+	/**
106
+	 * BCC property
107
+	 * 
108
+	 * @return Collection<Address>
109
+	 */
110
+	public function bcc() : Collection
111
+	{
112
+		return $this->foreachAddress($this->input('BccFull'));
113
+	}
114
+
115
+	/**
116
+	 * Subject property
117
+	 * 
118
+	 * @return String
119
+	 */
120
+	public function subject()
121
+	{
122
+		return $this->input('Subject');
123
+	}
124
+
125
+	/**
126
+	 * Body
127
+	 * 
128
+	 * @return String
129
+	 */
130
+	public function body()
131
+	{
132
+		$body = $this->bodyHtml();
133
+
134
+		if ($this->bodyIsText())
135
+			$body = $this->bodyText();
136
+
137
+		return $body;
138
+	}
139
+
140
+	/**
141
+	 * Return the body html
142
+	 * 
143
+	 * @return String
144
+	 */
145
+	public function bodyHtml()
146
+	{
147
+		return $this->input('HtmlBody');
148
+	}
149
+
150
+	/**
151
+	 * Return the body text
152
+	 * 
153
+	 * @return String
154
+	 */
155
+	public function bodyText()
156
+	{
157
+		return $this->input('TextBody');
158
+	}
159
+
160
+	/**
161
+	 * IsText
162
+	 * 
163
+	 * @return Boolean
164
+	 */
165
+	public function bodyIsText()
166
+	{
167
+		return ! $this->bodyIsHtml();
168
+	}
169
+
170
+	/**
171
+	 * IsHtml
172
+	 * 
173
+	 * @return Boolean
174
+	 */
175
+	public function bodyIsHtml()
176
+	{
177
+		return ! is_null($this->input('HtmlBody')) || $this->input('HtmlBody') !== '';
178
+	}
179
+
180
+	/**
181
+	 * Get email headers
182
+	 * 
183
+	 * @return Collection
184
+	 */
185
+	public function headers() : Collection
186
+	{
187
+		$collection = new Collection;
188
+
189
+		foreach ($this->input('Headers') as $header)
190
+			$collection->push(new Header($header['Name'], $header['Value']));
191
+
192
+		return $collection;
193
+	}
194
+
195
+	/**
196
+	 * retrieve a email header
197
+	 * 
198
+	 * return Array
199
+	 */
200
+	public function header($name) : Header
201
+	{
202
+		return $this->headers()->filter(function ($header) use ($name) {
203
+			return $header->name === $name;
204
+		})->first();
205
+	}
206
+
207
+	/**
208
+	 * Determinate if the email is marked as spam
209
+	 * 
210
+	 * @return Boolean
211
+	 */
212
+	public function isSpam()
213
+	{
214
+		$header = $this->header('X-Spam-Flag');
215
+		return $header->value === 'NO' ? false : true;
216
+	}
217
+
218
+	/**
219
+	 * Has attachements
220
+	 * 
221
+	 * @return Boolean
222
+	 */
223
+	public function hasAttachements()
224
+	{
225
+		return $this->attachements->isEmpty();
226
+	}
227
+
228
+	/**
229
+	 * Attachments
230
+	 * 
231
+	 * @return Collection<File>
232
+	 */
233
+	public function attachements() : Collection
234
+	{
235
+		$collection = new Collection;
236
+
237
+		foreach ($this->input('Attachments') as $attachment)
238
+			$collection->push(
239
+				new Attachment(
240
+					$attachment['Name'],
241
+					( isset($attachment['Content']) ? $attachment['Content'] : '' ),
242
+					$attachment['ContentType'],
243
+					$attachment['ContentLength']
244
+				)
245
+			);
246
+
247
+		return $collection;
248
+	}
249 249
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected function address(Array $input) : Address
43 43
     {
44
-        return new Address($input['Email'], $input['Name'], $input['MailboxHash']);
44
+        return new Address($input[ 'Email' ], $input[ 'Name' ], $input[ 'MailboxHash' ]);
45 45
     }
46 46
 
47 47
     /**
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      */
165 165
     public function bodyIsText()
166 166
     {
167
-        return ! $this->bodyIsHtml();
167
+        return !$this->bodyIsHtml();
168 168
     }
169 169
 
170 170
     /**
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      */
175 175
     public function bodyIsHtml()
176 176
     {
177
-        return ! is_null($this->input('HtmlBody')) || $this->input('HtmlBody') !== '';
177
+        return !is_null($this->input('HtmlBody')) || $this->input('HtmlBody') !== '';
178 178
     }
179 179
 
180 180
     /**
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         $collection = new Collection;
188 188
 
189 189
         foreach ($this->input('Headers') as $header)
190
-            $collection->push(new Header($header['Name'], $header['Value']));
190
+            $collection->push(new Header($header[ 'Name' ], $header[ 'Value' ]));
191 191
 
192 192
         return $collection;
193 193
     }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
      */
200 200
     public function header($name) : Header
201 201
     {
202
-        return $this->headers()->filter(function ($header) use ($name) {
202
+        return $this->headers()->filter(function($header) use ($name) {
203 203
             return $header->name === $name;
204 204
         })->first();
205 205
     }
@@ -237,10 +237,10 @@  discard block
 block discarded – undo
237 237
         foreach ($this->input('Attachments') as $attachment)
238 238
             $collection->push(
239 239
                 new Attachment(
240
-                    $attachment['Name'],
241
-                    ( isset($attachment['Content']) ? $attachment['Content'] : '' ),
242
-                    $attachment['ContentType'],
243
-                    $attachment['ContentLength']
240
+                    $attachment[ 'Name' ],
241
+                    (isset($attachment[ 'Content' ]) ? $attachment[ 'Content' ] : ''),
242
+                    $attachment[ 'ContentType' ],
243
+                    $attachment[ 'ContentLength' ]
244 244
                 )
245 245
             );
246 246
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@  discard block
 block discarded – undo
54 54
     {
55 55
         $collection = new Collection;
56 56
 
57
-        foreach ($input as $address)
58
-            $collection->push($this->address($address));
57
+        foreach ($input as $address) {
58
+                    $collection->push($this->address($address));
59
+        }
59 60
 
60 61
         return $collection;
61 62
     }
@@ -131,8 +132,9 @@  discard block
 block discarded – undo
131 132
     {
132 133
         $body = $this->bodyHtml();
133 134
 
134
-        if ($this->bodyIsText())
135
-            $body = $this->bodyText();
135
+        if ($this->bodyIsText()) {
136
+                    $body = $this->bodyText();
137
+        }
136 138
 
137 139
         return $body;
138 140
     }
@@ -186,8 +188,9 @@  discard block
 block discarded – undo
186 188
     {
187 189
         $collection = new Collection;
188 190
 
189
-        foreach ($this->input('Headers') as $header)
190
-            $collection->push(new Header($header['Name'], $header['Value']));
191
+        foreach ($this->input('Headers') as $header) {
192
+                    $collection->push(new Header($header['Name'], $header['Value']));
193
+        }
191 194
 
192 195
         return $collection;
193 196
     }
@@ -234,8 +237,8 @@  discard block
 block discarded – undo
234 237
     {
235 238
         $collection = new Collection;
236 239
 
237
-        foreach ($this->input('Attachments') as $attachment)
238
-            $collection->push(
240
+        foreach ($this->input('Attachments') as $attachment) {
241
+                    $collection->push(
239 242
                 new Attachment(
240 243
                     $attachment['Name'],
241 244
                     ( isset($attachment['Content']) ? $attachment['Content'] : '' ),
@@ -243,6 +246,7 @@  discard block
 block discarded – undo
243 246
                     $attachment['ContentLength']
244 247
                 )
245 248
             );
249
+        }
246 250
 
247 251
         return $collection;
248 252
     }
Please login to merge, or discard this patch.