1 | <?php |
||
42 | class ByPass extends EventableExtensionAbstract |
||
43 | { |
||
44 | /** |
||
45 | * bypass trigger in the url |
||
46 | * |
||
47 | * @var string |
||
48 | * @access protected |
||
49 | */ |
||
50 | protected $trigger = 'nocache'; |
||
51 | |||
52 | /** |
||
53 | * {@inheritDoc} |
||
54 | */ |
||
55 | public function methodsAvailable()/*# : array */ |
||
59 | |||
60 | /** |
||
61 | * {@inheritDoc} |
||
62 | */ |
||
63 | protected function extensionHandles()/*# : array */ |
||
69 | |||
70 | /** |
||
71 | * Skip the cache |
||
72 | * |
||
73 | * 1. $this->trigger = '', always bypass the cache |
||
74 | * 2. if sees $this->trigger in $_REQUEST, bypass the cache |
||
75 | * |
||
76 | * @param EventInterface $event |
||
77 | * @return bool |
||
78 | * @access public |
||
79 | */ |
||
80 | public function byPassCache(EventInterface $event)/*# : bool */ |
||
94 | } |
||
95 |
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: