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 ) { |
||
56 | |||
57 | /** |
||
58 | * Execute the handler returning raw result |
||
59 | * |
||
60 | * @return string|array|\Psr\Http\Message\ResponseInterface |
||
61 | */ |
||
62 | protected function executeHandler() { |
||
74 | |||
75 | /** |
||
76 | * Set the handler |
||
77 | * |
||
78 | * @param string|callable $new_handler |
||
79 | * @return null |
||
80 | */ |
||
81 | public function set( $new_handler ) { |
||
90 | |||
91 | /** |
||
92 | * Execute the handler |
||
93 | * |
||
94 | * @return \Psr\Http\Message\ResponseInterface |
||
|
|||
95 | */ |
||
96 | public function execute() { |
||
109 | } |
||
110 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.