| Total Complexity | 5 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | class Pimp { |
||
| 18 | const ORDER_REPLACE = -PHP_INT_MAX + 1; // Replaces current callback (?) |
||
| 19 | const ORDER_FIRST = self::ORDER_REPLACE + 1; |
||
| 20 | const ORDER_AS_IS = 0; |
||
| 21 | const ORDER_LAST = PHP_INT_MAX; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var GlobalContainer $gc |
||
| 25 | */ |
||
| 26 | protected $gc; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var Hooker[] $hookers |
||
| 30 | */ |
||
| 31 | protected $hookers = []; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Pimp constructor. |
||
| 35 | * |
||
| 36 | * @param GlobalContainer $gc |
||
| 37 | */ |
||
| 38 | 1 | public function __construct($gc) { |
|
| 40 | 1 | } |
|
| 41 | |||
| 42 | /** |
||
| 43 | * @param string $hookName |
||
| 44 | * @param $callable |
||
| 45 | * @param int $order |
||
| 46 | */ |
||
| 47 | 1 | public function register($hookName, $callable, $order = Pimp::ORDER_AS_IS) { |
|
| 48 | 1 | if (empty($this->hookers[$hookName])) { |
|
| 49 | 1 | $this->hookers[$hookName] = new Hooker($this); |
|
| 50 | 1 | } |
|
| 51 | |||
| 52 | 1 | $this->hookers[$hookName]->addClient($callable, $order); |
|
| 53 | 1 | } |
|
| 54 | |||
| 55 | /** |
||
| 56 | * @param $name |
||
| 57 | * @param $arguments |
||
| 58 | * |
||
| 59 | * @return mixed|null |
||
| 60 | */ |
||
| 61 | 1 | public function __call($name, $arguments) { |
|
| 66 | } |
||
| 67 | |||
| 69 |