Proxy   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A onInit() 0 3 2
A onSend() 0 6 2
1
<?php
2
3
/**
4
 * Email\Proxy
5
 *
6
 * Simple proxy driver. It pass all emails to an event
7
 *
8
 * @package core
9
 * @author [email protected]
10
 * @copyright Caffeina srl - 2016 - http://caffeina.com
11
 */
12
13
namespace Email;
14
15
class Proxy implements Driver {
16
17
  protected $listener = 'core.email.proxy.send';
18
19
  public function onInit($options){
20
    if (!empty($options['hook'])) $this->listener = $options['hook'];
21
  }
22
23
  public function onSend(Envelope $envelope){
24
    return array_reduce( (array) \Event::trigger($this->listener, $envelope), function($carry, $item) {
25
    	 if (is_bool($item)) $carry[] = $item;
26
    	 return $carry;
27
    }, []);
28
  }
29
30
}
31
32