| Total Complexity | 4 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class EnvironmentBypass implements Bypass |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * The list of environments allowing a bypass for a confirmation |
||
| 16 | * |
||
| 17 | * @var string[] |
||
| 18 | */ |
||
| 19 | private $environments; |
||
| 20 | |||
| 21 | |||
| 22 | /** |
||
| 23 | * Initialize the bypass with the list of environment types |
||
| 24 | * |
||
| 25 | * @param string[] ...$environments |
||
| 26 | */ |
||
| 27 | public function __construct(...$environments) |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Returns the list of environments |
||
| 34 | * |
||
| 35 | * @return string[] |
||
| 36 | * |
||
| 37 | */ |
||
| 38 | public function getEnvironments() |
||
| 39 | { |
||
| 40 | return $this->environments; |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Set the list of environments allowing a bypass |
||
| 45 | * |
||
| 46 | * @param string[] $environments List of environment types |
||
| 47 | * |
||
| 48 | * @return $this |
||
| 49 | */ |
||
| 50 | public function setEnvironments($environments) |
||
| 51 | { |
||
| 52 | $this->environments = $environments; |
||
| 53 | return $this; |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Checks whether the current environment type in the list |
||
| 58 | * of allowed ones |
||
| 59 | * |
||
| 60 | * @param HTTPRequest $request |
||
| 61 | * |
||
| 62 | * @return bool |
||
| 63 | */ |
||
| 64 | public function checkRequestForBypass(HTTPRequest $request) |
||
| 67 | } |
||
| 68 | } |
||
| 69 |