1 | <?php |
||
36 | class RedirectToHttps extends EventableExtensionAbstract |
||
37 | { |
||
38 | /** |
||
39 | * {@inheritDoc} |
||
40 | */ |
||
41 | public function methodsAvailable()/*# : array */ |
||
45 | |||
46 | /** |
||
47 | * Extension methods takes an event as input. |
||
48 | * |
||
49 | * Event params has `Phossa2\Route\Result` set as 'result' |
||
50 | * |
||
51 | * MUST RETURN A BOOLEAN VALUE !!! |
||
52 | * |
||
53 | * @param EventInterface $event |
||
54 | * @return bool |
||
55 | * @access protected |
||
56 | */ |
||
57 | public function redirectIt(EventInterface $event)/*# : bool */ |
||
68 | |||
69 | /** |
||
70 | * Return event handlers of this extension handling |
||
71 | * |
||
72 | * ```php |
||
73 | * protected function extensionHandles() |
||
74 | * { |
||
75 | * return [ |
||
76 | * ['event' => 'cache.*', 'handler' => ['byPassCache', 100]], |
||
77 | * ]; |
||
78 | * } |
||
79 | * ``` |
||
80 | * |
||
81 | * @return array |
||
82 | * @access protected |
||
83 | */ |
||
84 | protected function extensionHandles()/*# : array */ |
||
93 | } |
||
94 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: