1 | <?php |
||
12 | class Handler { |
||
13 | /** |
||
14 | * Actual handler |
||
15 | * |
||
16 | * @var callable|array|null |
||
17 | */ |
||
18 | protected $handler = null; |
||
19 | |||
20 | /** |
||
21 | * Constructor |
||
22 | * |
||
23 | * @param string|callable $handler |
||
24 | */ |
||
25 | public function __construct( $handler ) { |
||
28 | |||
29 | /** |
||
30 | * Parse a handler to a callable or a [class, method] array |
||
31 | * |
||
32 | * @param string|callable $handler |
||
33 | * @return callable|array|null |
||
34 | */ |
||
35 | protected function parse( $handler ) { |
||
46 | |||
47 | /** |
||
48 | * Parse a string handler to a callable or a [class, method] array |
||
49 | * |
||
50 | * @param string $handler |
||
51 | * @return callable|array|null |
||
52 | */ |
||
53 | protected function parseFromString( $handler ) { |
||
68 | |||
69 | /** |
||
70 | * Execute the handler returning raw result |
||
71 | * |
||
72 | * @return string|array|\Psr\Http\Message\ResponseInterface |
||
73 | */ |
||
74 | protected function executeHandler() { |
||
86 | |||
87 | /** |
||
88 | * Set the handler |
||
89 | * |
||
90 | * @param string|callable $new_handler |
||
91 | * @return null |
||
92 | */ |
||
93 | public function set( $new_handler ) { |
||
102 | |||
103 | /** |
||
104 | * Execute the handler |
||
105 | * |
||
106 | * @return \Psr\Http\Message\ResponseInterface |
||
107 | */ |
||
108 | public function execute() { |
||
121 | } |
||
122 |