@@ -22,8 +22,8 @@ |
||
22 | 22 | |
23 | 23 | public function onSend(Envelope $envelope){ |
24 | 24 | return array_reduce( (array) \Event::trigger($this->listener, $envelope), function($carry, $item) { |
25 | - if (is_bool($item)) $carry[] = $item; |
|
26 | - return $carry; |
|
25 | + if (is_bool($item)) $carry[] = $item; |
|
26 | + return $carry; |
|
27 | 27 | }, []); |
28 | 28 | } |
29 | 29 |
@@ -16,12 +16,12 @@ |
||
16 | 16 | |
17 | 17 | protected $listener = 'core.email.proxy.send'; |
18 | 18 | |
19 | - public function onInit($options){ |
|
19 | + public function onInit($options) { |
|
20 | 20 | if (!empty($options['hook'])) $this->listener = $options['hook']; |
21 | 21 | } |
22 | 22 | |
23 | - public function onSend(Envelope $envelope){ |
|
24 | - return array_reduce( (array) \Event::trigger($this->listener, $envelope), function($carry, $item) { |
|
23 | + public function onSend(Envelope $envelope) { |
|
24 | + return array_reduce((array) \Event::trigger($this->listener, $envelope), function($carry, $item) { |
|
25 | 25 | if (is_bool($item)) $carry[] = $item; |
26 | 26 | return $carry; |
27 | 27 | }, []); |
@@ -16,13 +16,17 @@ |
||
16 | 16 | |
17 | 17 | protected $listener = 'core.email.proxy.send'; |
18 | 18 | |
19 | - public function onInit($options){ |
|
20 | - if (!empty($options['hook'])) $this->listener = $options['hook']; |
|
19 | + public function onInit($options) { |
|
20 | + if (!empty($options['hook'])) { |
|
21 | + $this->listener = $options['hook']; |
|
22 | + } |
|
21 | 23 | } |
22 | 24 | |
23 | - public function onSend(Envelope $envelope){ |
|
25 | + public function onSend(Envelope $envelope) { |
|
24 | 26 | return array_reduce( (array) \Event::trigger($this->listener, $envelope), function($carry, $item) { |
25 | - if (is_bool($item)) $carry[] = $item; |
|
27 | + if (is_bool($item)) { |
|
28 | + $carry[] = $item; |
|
29 | + } |
|
26 | 30 | return $carry; |
27 | 31 | }, []); |
28 | 32 | } |
@@ -17,17 +17,17 @@ discard block |
||
17 | 17 | $options, |
18 | 18 | $driver_name; |
19 | 19 | |
20 | - public static function using($driver, $options = null){ |
|
20 | + public static function using($driver, $options = null) { |
|
21 | 21 | $class = 'Email\\'.ucfirst(strtolower($driver)); |
22 | - if ( ! class_exists($class) ) throw new Exception("[core.email] : $driver driver not found."); |
|
22 | + if (!class_exists($class)) throw new Exception("[core.email] : $driver driver not found."); |
|
23 | 23 | static::$driver_name = $driver; |
24 | 24 | static::$options = $options; |
25 | 25 | static::$driver = new $class; |
26 | 26 | static::$driver->onInit($options); |
27 | 27 | } |
28 | 28 | |
29 | - public static function create($mail=[]){ |
|
30 | - if (is_a($mail, 'Email\\Envelope')){ |
|
29 | + public static function create($mail = []) { |
|
30 | + if (is_a($mail, 'Email\\Envelope')) { |
|
31 | 31 | return $mail; |
32 | 32 | } else { |
33 | 33 | return new Email\Envelope(array_merge([ |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | - public static function send($mail){ |
|
46 | + public static function send($mail) { |
|
47 | 47 | $envelope = static::create($mail); |
48 | 48 | $results = (array) static::$driver->onSend($envelope); |
49 | 49 | Event::trigger('core.email.send', $envelope->to(), $envelope, static::$driver, $results); |
50 | - return count($results) && array_reduce( $results, function($carry, $item) { |
|
50 | + return count($results) && array_reduce($results, function($carry, $item) { |
|
51 | 51 | return $carry && $item; |
52 | - }, true ); |
|
52 | + }, true); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | } |