| 1 | <?php |
||
| 8 | class Chain |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var Chain |
||
| 12 | */ |
||
| 13 | private $next; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var callable |
||
| 17 | */ |
||
| 18 | private $callback; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Chain constructor. |
||
| 22 | */ |
||
| 23 | private function __construct() |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @return Chain |
||
| 31 | */ |
||
| 32 | public static function createBase(): Chain |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @param callable $callback |
||
| 39 | * |
||
| 40 | * @return Chain |
||
| 41 | */ |
||
| 42 | public static function createWith(callable $callback): Chain |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @param Chain $element |
||
| 52 | * |
||
| 53 | * @return $this |
||
| 54 | */ |
||
| 55 | public function add(Chain $element) |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @param Container $container |
||
| 68 | * |
||
| 69 | * @return mixed |
||
| 70 | */ |
||
| 71 | public function handle(Container $container): Container |
||
| 92 | } |
||
| 93 |