| Total Complexity | 4 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | trait Singleton |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @param $binder // The binder is a class property, preferably a protected/private one |
||
|
|
|||
| 21 | * @param callable $logic |
||
| 22 | * @return mixed |
||
| 23 | */ |
||
| 24 | protected function singleton($binder, callable $logic) |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @param $binder |
||
| 34 | * @param callable $logic |
||
| 35 | * @param int $index |
||
| 36 | * @return mixed |
||
| 37 | */ |
||
| 38 | protected function singletonKeyed($binder, callable $logic, $index = 0) |
||
| 46 |