@@ -6,36 +6,36 @@ |
||
6 | 6 | |
7 | 7 | abstract class AbstractHandler |
8 | 8 | { |
9 | - /** |
|
10 | - * @var ParserInterface |
|
11 | - */ |
|
12 | - protected $parser; |
|
9 | + /** |
|
10 | + * @var ParserInterface |
|
11 | + */ |
|
12 | + protected $parser; |
|
13 | 13 | |
14 | - /** |
|
15 | - * Constructor |
|
16 | - * |
|
17 | - * @param ParserInterface $parser |
|
18 | - */ |
|
19 | - public function __construct(ParserInterface $parser) |
|
20 | - { |
|
21 | - $this->parser = $parser; |
|
22 | - } |
|
14 | + /** |
|
15 | + * Constructor |
|
16 | + * |
|
17 | + * @param ParserInterface $parser |
|
18 | + */ |
|
19 | + public function __construct(ParserInterface $parser) |
|
20 | + { |
|
21 | + $this->parser = $parser; |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * Access the parser |
|
26 | - * |
|
27 | - * @return ParserInterface |
|
28 | - */ |
|
29 | - public function parser() |
|
30 | - { |
|
31 | - return $this->parser; |
|
32 | - } |
|
24 | + /** |
|
25 | + * Access the parser |
|
26 | + * |
|
27 | + * @return ParserInterface |
|
28 | + */ |
|
29 | + public function parser() |
|
30 | + { |
|
31 | + return $this->parser; |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Run the handler |
|
36 | - * |
|
37 | - * @param Mixed $parsed |
|
38 | - * @return Mixed |
|
39 | - */ |
|
40 | - public abstract function run($parsed); |
|
34 | + /** |
|
35 | + * Run the handler |
|
36 | + * |
|
37 | + * @param Mixed $parsed |
|
38 | + * @return Mixed |
|
39 | + */ |
|
40 | + public abstract function run($parsed); |
|
41 | 41 | } |
@@ -7,50 +7,50 @@ |
||
7 | 7 | |
8 | 8 | class GatewayManager |
9 | 9 | { |
10 | - /** |
|
11 | - * @var Request |
|
12 | - */ |
|
13 | - protected $request; |
|
14 | - |
|
15 | - /** |
|
16 | - * @var ParserInterface |
|
17 | - */ |
|
18 | - protected $parser; |
|
19 | - |
|
20 | - /** |
|
21 | - * @var HandlerInterface |
|
22 | - */ |
|
23 | - protected $handler; |
|
24 | - |
|
25 | - /** |
|
26 | - * |
|
27 | - */ |
|
28 | - public function __construct(AbstractHandler $handler, Request $request) |
|
29 | - { |
|
30 | - $this->handler = $handler; |
|
31 | - $this->request = $request; |
|
10 | + /** |
|
11 | + * @var Request |
|
12 | + */ |
|
13 | + protected $request; |
|
14 | + |
|
15 | + /** |
|
16 | + * @var ParserInterface |
|
17 | + */ |
|
18 | + protected $parser; |
|
19 | + |
|
20 | + /** |
|
21 | + * @var HandlerInterface |
|
22 | + */ |
|
23 | + protected $handler; |
|
24 | + |
|
25 | + /** |
|
26 | + * |
|
27 | + */ |
|
28 | + public function __construct(AbstractHandler $handler, Request $request) |
|
29 | + { |
|
30 | + $this->handler = $handler; |
|
31 | + $this->request = $request; |
|
32 | 32 | |
33 | - $this->parser = $handler->parser(); |
|
34 | - $this->parser->request($request); |
|
35 | - } |
|
36 | - |
|
37 | - /** |
|
38 | - * Parse the inbound request |
|
39 | - * |
|
40 | - * @return ParserInterface |
|
41 | - */ |
|
42 | - public function parse() |
|
43 | - { |
|
44 | - return $this->parser->parse(); |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * Run the handler |
|
49 | - * |
|
50 | - * @return ?? |
|
51 | - */ |
|
52 | - public function runHandler() |
|
53 | - { |
|
54 | - return $this->handler->run($this->parse()); |
|
55 | - } |
|
33 | + $this->parser = $handler->parser(); |
|
34 | + $this->parser->request($request); |
|
35 | + } |
|
36 | + |
|
37 | + /** |
|
38 | + * Parse the inbound request |
|
39 | + * |
|
40 | + * @return ParserInterface |
|
41 | + */ |
|
42 | + public function parse() |
|
43 | + { |
|
44 | + return $this->parser->parse(); |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * Run the handler |
|
49 | + * |
|
50 | + * @return ?? |
|
51 | + */ |
|
52 | + public function runHandler() |
|
53 | + { |
|
54 | + return $this->handler->run($this->parse()); |
|
55 | + } |
|
56 | 56 | } |
@@ -8,39 +8,39 @@ |
||
8 | 8 | |
9 | 9 | class Inbounder |
10 | 10 | { |
11 | - /** |
|
12 | - * Class constructor |
|
13 | - * |
|
14 | - * @param App $app |
|
15 | - */ |
|
16 | - public function __construct($app) |
|
17 | - { |
|
18 | - $this->app = $app; |
|
19 | - } |
|
11 | + /** |
|
12 | + * Class constructor |
|
13 | + * |
|
14 | + * @param App $app |
|
15 | + */ |
|
16 | + public function __construct($app) |
|
17 | + { |
|
18 | + $this->app = $app; |
|
19 | + } |
|
20 | 20 | |
21 | - /** |
|
22 | - * Create a new instance handler for the given gateway |
|
23 | - * |
|
24 | - * @param String $name |
|
25 | - * @return AbstractHandler |
|
26 | - */ |
|
27 | - protected function newHandlerInstanceFor($name) |
|
28 | - { |
|
29 | - if ( ! $handler = config('inbounder.gateways.' . $name)) |
|
30 | - throw new UndefinedGatewayException('The gateway \''.$name.'\' is not defined'); |
|
21 | + /** |
|
22 | + * Create a new instance handler for the given gateway |
|
23 | + * |
|
24 | + * @param String $name |
|
25 | + * @return AbstractHandler |
|
26 | + */ |
|
27 | + protected function newHandlerInstanceFor($name) |
|
28 | + { |
|
29 | + if ( ! $handler = config('inbounder.gateways.' . $name)) |
|
30 | + throw new UndefinedGatewayException('The gateway \''.$name.'\' is not defined'); |
|
31 | 31 | |
32 | - return $this->app->make($handler); |
|
33 | - } |
|
32 | + return $this->app->make($handler); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * Return an instance of the gateway manager |
|
37 | - * |
|
38 | - * @param String $gateway |
|
39 | - * @param Request $request |
|
40 | - * @return GatewayManager |
|
41 | - */ |
|
42 | - public function gateway($gateway, Request $request) |
|
43 | - { |
|
44 | - return new GatewayManager($this->newHandlerInstanceFor($gateway), $request); |
|
45 | - } |
|
35 | + /** |
|
36 | + * Return an instance of the gateway manager |
|
37 | + * |
|
38 | + * @param String $gateway |
|
39 | + * @param Request $request |
|
40 | + * @return GatewayManager |
|
41 | + */ |
|
42 | + public function gateway($gateway, Request $request) |
|
43 | + { |
|
44 | + return new GatewayManager($this->newHandlerInstanceFor($gateway), $request); |
|
45 | + } |
|
46 | 46 | } |
@@ -26,8 +26,8 @@ |
||
26 | 26 | */ |
27 | 27 | protected function newHandlerInstanceFor($name) |
28 | 28 | { |
29 | - if ( ! $handler = config('inbounder.gateways.' . $name)) |
|
30 | - throw new UndefinedGatewayException('The gateway \''.$name.'\' is not defined'); |
|
29 | + if (!$handler = config('inbounder.gateways.' . $name)) |
|
30 | + throw new UndefinedGatewayException('The gateway \'' . $name . '\' is not defined'); |
|
31 | 31 | |
32 | 32 | return $this->app->make($handler); |
33 | 33 | } |
@@ -26,8 +26,9 @@ |
||
26 | 26 | */ |
27 | 27 | protected function newHandlerInstanceFor($name) |
28 | 28 | { |
29 | - if ( ! $handler = config('inbounder.gateways.' . $name)) |
|
30 | - throw new UndefinedGatewayException('The gateway \''.$name.'\' is not defined'); |
|
29 | + if ( ! $handler = config('inbounder.gateways.' . $name)) { |
|
30 | + throw new UndefinedGatewayException('The gateway \''.$name.'\' is not defined'); |
|
31 | + } |
|
31 | 32 | |
32 | 33 | return $this->app->make($handler); |
33 | 34 | } |
@@ -7,34 +7,34 @@ |
||
7 | 7 | |
8 | 8 | class InbounderServiceProvider extends ServiceProvider |
9 | 9 | { |
10 | - /** |
|
11 | - * Indicates if loading of the provider is deferred. |
|
12 | - * |
|
13 | - * @var bool |
|
14 | - */ |
|
15 | - protected $defer = false; |
|
10 | + /** |
|
11 | + * Indicates if loading of the provider is deferred. |
|
12 | + * |
|
13 | + * @var bool |
|
14 | + */ |
|
15 | + protected $defer = false; |
|
16 | 16 | |
17 | - /** |
|
18 | - * Register bindings in the container. |
|
19 | - * |
|
20 | - * @return void |
|
21 | - */ |
|
22 | - public function register() |
|
23 | - { |
|
24 | - $this->app->bind('inbounder', function ($app) { |
|
25 | - return new Inbounder($app); |
|
26 | - }); |
|
27 | - } |
|
17 | + /** |
|
18 | + * Register bindings in the container. |
|
19 | + * |
|
20 | + * @return void |
|
21 | + */ |
|
22 | + public function register() |
|
23 | + { |
|
24 | + $this->app->bind('inbounder', function ($app) { |
|
25 | + return new Inbounder($app); |
|
26 | + }); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Perform post-registration booting of services. |
|
31 | - * |
|
32 | - * @return void |
|
33 | - */ |
|
34 | - public function boot() |
|
35 | - { |
|
36 | - $this->publishes([ |
|
37 | - __DIR__.'/../config.php' => config_path('inbounder.php') |
|
38 | - ], 'config'); |
|
39 | - } |
|
29 | + /** |
|
30 | + * Perform post-registration booting of services. |
|
31 | + * |
|
32 | + * @return void |
|
33 | + */ |
|
34 | + public function boot() |
|
35 | + { |
|
36 | + $this->publishes([ |
|
37 | + __DIR__.'/../config.php' => config_path('inbounder.php') |
|
38 | + ], 'config'); |
|
39 | + } |
|
40 | 40 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function register() |
23 | 23 | { |
24 | - $this->app->bind('inbounder', function ($app) { |
|
24 | + $this->app->bind('inbounder', function($app) { |
|
25 | 25 | return new Inbounder($app); |
26 | 26 | }); |
27 | 27 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | public function boot() |
35 | 35 | { |
36 | 36 | $this->publishes([ |
37 | - __DIR__.'/../config.php' => config_path('inbounder.php') |
|
37 | + __DIR__ . '/../config.php' => config_path('inbounder.php') |
|
38 | 38 | ], 'config'); |
39 | 39 | } |
40 | 40 | } |
@@ -8,71 +8,71 @@ |
||
8 | 8 | |
9 | 9 | abstract class AbstractParser implements ParserInterface, Arrayable |
10 | 10 | { |
11 | - /** |
|
12 | - * Request |
|
13 | - */ |
|
14 | - protected $request; |
|
11 | + /** |
|
12 | + * Request |
|
13 | + */ |
|
14 | + protected $request; |
|
15 | 15 | |
16 | - /** |
|
17 | - * Attributes |
|
18 | - */ |
|
19 | - protected $attributes; |
|
16 | + /** |
|
17 | + * Attributes |
|
18 | + */ |
|
19 | + protected $attributes; |
|
20 | 20 | |
21 | - /** |
|
22 | - * |
|
23 | - */ |
|
24 | - public function __set($name, $value) |
|
25 | - { |
|
26 | - $this->attributes[$name] = $value; |
|
27 | - } |
|
21 | + /** |
|
22 | + * |
|
23 | + */ |
|
24 | + public function __set($name, $value) |
|
25 | + { |
|
26 | + $this->attributes[$name] = $value; |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Getter |
|
31 | - */ |
|
32 | - public function __get($name) |
|
33 | - { |
|
34 | - if (array_key_exists($name, $this->attributes)) |
|
35 | - return $this->attributes[$name]; |
|
29 | + /** |
|
30 | + * Getter |
|
31 | + */ |
|
32 | + public function __get($name) |
|
33 | + { |
|
34 | + if (array_key_exists($name, $this->attributes)) |
|
35 | + return $this->attributes[$name]; |
|
36 | 36 | |
37 | - return null; |
|
38 | - } |
|
37 | + return null; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Parse the request and return itself |
|
42 | - * |
|
43 | - * @return ParserInterface |
|
44 | - */ |
|
45 | - public abstract function parse() : ParserInterface; |
|
40 | + /** |
|
41 | + * Parse the request and return itself |
|
42 | + * |
|
43 | + * @return ParserInterface |
|
44 | + */ |
|
45 | + public abstract function parse() : ParserInterface; |
|
46 | 46 | |
47 | - /** |
|
48 | - * Set the request that will be parsed |
|
49 | - * |
|
50 | - * @param Request $request |
|
51 | - * @return Void |
|
52 | - */ |
|
53 | - public function request(Request $request) |
|
54 | - { |
|
55 | - $this->request = $request; |
|
56 | - } |
|
47 | + /** |
|
48 | + * Set the request that will be parsed |
|
49 | + * |
|
50 | + * @param Request $request |
|
51 | + * @return Void |
|
52 | + */ |
|
53 | + public function request(Request $request) |
|
54 | + { |
|
55 | + $this->request = $request; |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * Retrieve an input from the request |
|
60 | - * |
|
61 | - * @param String $name |
|
62 | - * @return Mixed |
|
63 | - */ |
|
64 | - public function input($name) |
|
65 | - { |
|
66 | - return $this->request->input($name); |
|
67 | - } |
|
58 | + /** |
|
59 | + * Retrieve an input from the request |
|
60 | + * |
|
61 | + * @param String $name |
|
62 | + * @return Mixed |
|
63 | + */ |
|
64 | + public function input($name) |
|
65 | + { |
|
66 | + return $this->request->input($name); |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * Get the instance as an array. |
|
71 | - * |
|
72 | - * @return array |
|
73 | - */ |
|
74 | - public function toArray() |
|
75 | - { |
|
76 | - return $this->attributes; |
|
77 | - } |
|
69 | + /** |
|
70 | + * Get the instance as an array. |
|
71 | + * |
|
72 | + * @return array |
|
73 | + */ |
|
74 | + public function toArray() |
|
75 | + { |
|
76 | + return $this->attributes; |
|
77 | + } |
|
78 | 78 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __set($name, $value) |
25 | 25 | { |
26 | - $this->attributes[$name] = $value; |
|
26 | + $this->attributes[ $name ] = $value; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function __get($name) |
33 | 33 | { |
34 | 34 | if (array_key_exists($name, $this->attributes)) |
35 | - return $this->attributes[$name]; |
|
35 | + return $this->attributes[ $name ]; |
|
36 | 36 | |
37 | 37 | return null; |
38 | 38 | } |
@@ -31,8 +31,9 @@ |
||
31 | 31 | */ |
32 | 32 | public function __get($name) |
33 | 33 | { |
34 | - if (array_key_exists($name, $this->attributes)) |
|
35 | - return $this->attributes[$name]; |
|
34 | + if (array_key_exists($name, $this->attributes)) { |
|
35 | + return $this->attributes[$name]; |
|
36 | + } |
|
36 | 37 | |
37 | 38 | return null; |
38 | 39 | } |
@@ -8,87 +8,87 @@ |
||
8 | 8 | |
9 | 9 | interface EmailParserInterface extends ParserInterface |
10 | 10 | { |
11 | - /** |
|
12 | - * From property |
|
13 | - * |
|
14 | - * @return Address |
|
15 | - */ |
|
16 | - public function from() : Address; |
|
11 | + /** |
|
12 | + * From property |
|
13 | + * |
|
14 | + * @return Address |
|
15 | + */ |
|
16 | + public function from() : Address; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Reply-to property |
|
20 | - * |
|
21 | - * @return Address |
|
22 | - */ |
|
23 | - public function replyTo() : Address; |
|
18 | + /** |
|
19 | + * Reply-to property |
|
20 | + * |
|
21 | + * @return Address |
|
22 | + */ |
|
23 | + public function replyTo() : Address; |
|
24 | 24 | |
25 | - /** |
|
26 | - * To property |
|
27 | - * |
|
28 | - * @return Collection<Address> |
|
29 | - */ |
|
30 | - public function to() : Collection; |
|
25 | + /** |
|
26 | + * To property |
|
27 | + * |
|
28 | + * @return Collection<Address> |
|
29 | + */ |
|
30 | + public function to() : Collection; |
|
31 | 31 | |
32 | - /** |
|
33 | - * CC property |
|
34 | - * |
|
35 | - * @return Collection<Address> |
|
36 | - */ |
|
37 | - public function cc() : Collection; |
|
32 | + /** |
|
33 | + * CC property |
|
34 | + * |
|
35 | + * @return Collection<Address> |
|
36 | + */ |
|
37 | + public function cc() : Collection; |
|
38 | 38 | |
39 | - /** |
|
40 | - * BCC property |
|
41 | - * |
|
42 | - * @return Collection<Address> |
|
43 | - */ |
|
44 | - public function bcc() : Collection; |
|
39 | + /** |
|
40 | + * BCC property |
|
41 | + * |
|
42 | + * @return Collection<Address> |
|
43 | + */ |
|
44 | + public function bcc() : Collection; |
|
45 | 45 | |
46 | - /** |
|
47 | - * Subject property |
|
48 | - * |
|
49 | - * @return String |
|
50 | - */ |
|
51 | - public function subject(); |
|
46 | + /** |
|
47 | + * Subject property |
|
48 | + * |
|
49 | + * @return String |
|
50 | + */ |
|
51 | + public function subject(); |
|
52 | 52 | |
53 | - /** |
|
54 | - * Body |
|
55 | - * |
|
56 | - * @return String |
|
57 | - */ |
|
58 | - public function body(); |
|
53 | + /** |
|
54 | + * Body |
|
55 | + * |
|
56 | + * @return String |
|
57 | + */ |
|
58 | + public function body(); |
|
59 | 59 | |
60 | - /** |
|
61 | - * IsText |
|
62 | - * |
|
63 | - * @return Boolean |
|
64 | - */ |
|
65 | - public function bodyIsText(); |
|
60 | + /** |
|
61 | + * IsText |
|
62 | + * |
|
63 | + * @return Boolean |
|
64 | + */ |
|
65 | + public function bodyIsText(); |
|
66 | 66 | |
67 | - /** |
|
68 | - * IsHtml |
|
69 | - * |
|
70 | - * @return Boolean |
|
71 | - */ |
|
72 | - public function bodyIsHtml(); |
|
67 | + /** |
|
68 | + * IsHtml |
|
69 | + * |
|
70 | + * @return Boolean |
|
71 | + */ |
|
72 | + public function bodyIsHtml(); |
|
73 | 73 | |
74 | - /** |
|
75 | - * Determinate if the email is marked as spam |
|
76 | - * |
|
77 | - * @return Boolean |
|
78 | - */ |
|
79 | - public function isSpam(); |
|
74 | + /** |
|
75 | + * Determinate if the email is marked as spam |
|
76 | + * |
|
77 | + * @return Boolean |
|
78 | + */ |
|
79 | + public function isSpam(); |
|
80 | 80 | |
81 | - /** |
|
82 | - * Has attachements |
|
83 | - * |
|
84 | - * @return Boolean |
|
85 | - */ |
|
86 | - public function hasAttachements(); |
|
81 | + /** |
|
82 | + * Has attachements |
|
83 | + * |
|
84 | + * @return Boolean |
|
85 | + */ |
|
86 | + public function hasAttachements(); |
|
87 | 87 | |
88 | - /** |
|
89 | - * Attachments |
|
90 | - * |
|
91 | - * @return Array[Array['name', 'content', 'type']] |
|
92 | - */ |
|
93 | - public function attachements(); |
|
88 | + /** |
|
89 | + * Attachments |
|
90 | + * |
|
91 | + * @return Array[Array['name', 'content', 'type']] |
|
92 | + */ |
|
93 | + public function attachements(); |
|
94 | 94 | } |
@@ -4,5 +4,5 @@ |
||
4 | 4 | |
5 | 5 | interface ParserInterface |
6 | 6 | { |
7 | - public function parse(); |
|
7 | + public function parse(); |
|
8 | 8 | } |
@@ -6,11 +6,11 @@ |
||
6 | 6 | |
7 | 7 | class Attachment extends Object |
8 | 8 | { |
9 | - public function __construct($name, $content, $type, $length) |
|
10 | - { |
|
11 | - $this->name = $name; |
|
12 | - $this->content = $content; |
|
13 | - $this->type = $type; |
|
14 | - $this->length = $length; |
|
15 | - } |
|
9 | + public function __construct($name, $content, $type, $length) |
|
10 | + { |
|
11 | + $this->name = $name; |
|
12 | + $this->content = $content; |
|
13 | + $this->type = $type; |
|
14 | + $this->length = $length; |
|
15 | + } |
|
16 | 16 | } |
@@ -6,13 +6,13 @@ |
||
6 | 6 | |
7 | 7 | class Address extends Object |
8 | 8 | { |
9 | - /** |
|
10 | - * Constructor |
|
11 | - */ |
|
12 | - public function __construct($email, $name = null, $mailboxHash = null) |
|
13 | - { |
|
14 | - $this->email = $email; |
|
15 | - $this->name = $name; |
|
16 | - $this->mailboxHash = $mailboxHash; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Constructor |
|
11 | + */ |
|
12 | + public function __construct($email, $name = null, $mailboxHash = null) |
|
13 | + { |
|
14 | + $this->email = $email; |
|
15 | + $this->name = $name; |
|
16 | + $this->mailboxHash = $mailboxHash; |
|
17 | + } |
|
18 | 18 | } |