1 | <?php |
||
12 | class ConfirmationTokenChain |
||
13 | { |
||
14 | /** |
||
15 | * @var array |
||
16 | */ |
||
17 | protected $tokens = array(); |
||
18 | |||
19 | /** |
||
20 | * @param AbstractConfirmationToken $token |
||
21 | */ |
||
22 | public function pushToken(AbstractConfirmationToken $token) { |
||
25 | |||
26 | /** |
||
27 | * Collect all tokens that require a redirect |
||
28 | * |
||
29 | * @return array |
||
30 | */ |
||
31 | protected function filteredTokens() { |
||
41 | |||
42 | /** |
||
43 | * @return bool |
||
44 | */ |
||
45 | public function suppressionRequired() { |
||
48 | |||
49 | /** |
||
50 | * Suppress URLs & GET vars from tokens that require a redirect |
||
51 | */ |
||
52 | public function suppressTokens() { |
||
57 | |||
58 | /** |
||
59 | * @return bool |
||
60 | */ |
||
61 | public function reloadRequired() { |
||
70 | |||
71 | /** |
||
72 | * @return bool |
||
73 | */ |
||
74 | public function reloadRequiredIfError() { |
||
83 | |||
84 | /** |
||
85 | * @param bool $includeToken |
||
86 | * @return array |
||
87 | */ |
||
88 | public function params($includeToken = true) { |
||
96 | |||
97 | /** |
||
98 | * Fetch the URL we want to redirect to, excluding query string parameters. This may |
||
99 | * be the same URL (with a token to be added outside this method), or to a different |
||
100 | * URL if the current one has been suppressed |
||
101 | * |
||
102 | * @return string |
||
103 | */ |
||
104 | public function getRedirectUrlBase() { |
||
119 | |||
120 | /** |
||
121 | * Collate GET vars from all token providers that need to apply a token |
||
122 | * |
||
123 | * @return array |
||
124 | */ |
||
125 | public function getRedirectUrlParams() { |
||
133 | |||
134 | /** |
||
135 | * @return string |
||
136 | */ |
||
137 | protected function redirectURL() { |
||
141 | |||
142 | /** |
||
143 | * Forces a reload of the request with the applicable tokens included |
||
144 | */ |
||
145 | public function reloadWithToken() { |
||
163 | } |
||
164 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.