| Total Complexity | 6 | 
| Total Lines | 60 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 11 | class MockState extends SiteState implements TestOnly, SiteStateInterface | ||
| 12 | { | ||
| 13 | public $enabled = false; | ||
| 14 | |||
| 15 | public function appliesToEnvironment(): bool | ||
| 16 |     { | ||
| 17 | return $this->enabled; | ||
| 18 | } | ||
| 19 | |||
| 20 | /** | ||
| 21 | * Reset the SiteState to it's default state | ||
| 22 | * | ||
| 23 | * @return mixed | ||
| 24 | */ | ||
| 25 | public function setDefaultState($state = null) | ||
| 26 |     { | ||
| 27 |         $this->activateState('default'); | ||
| 28 | } | ||
| 29 | |||
| 30 | /** | ||
| 31 | * Activate a given state. This should only be done if the state is applicable | ||
| 32 | * | ||
| 33 | * @param string $state | ||
| 34 | * @return mixed | ||
| 35 | */ | ||
| 36 | public function activateState($state) | ||
| 37 |     { | ||
| 38 | $this->state = $state; | ||
| 39 | } | ||
| 40 | |||
| 41 | /** | ||
| 42 | * Return the current state of the site | ||
| 43 | * | ||
| 44 | * @return string | ||
| 45 | */ | ||
| 46 | public function currentState(): string | ||
| 47 |     { | ||
| 48 | return 'default'; | ||
| 49 | } | ||
| 50 | |||
| 51 | /** | ||
| 52 | * Is this state applicable to this extension | ||
| 53 | * E.g. in case of Fluent, the state "SubsiteID1" does not make sense | ||
| 54 | * | ||
| 55 | * @param string $state | ||
| 56 | * @return bool | ||
| 57 | */ | ||
| 58 | public function stateIsApplicable($state): bool | ||
| 59 |     { | ||
| 60 | return in_array($state, ['default', 'other']); | ||
| 61 | } | ||
| 62 | |||
| 63 | /** | ||
| 64 | * Method to alter the query. Can be no-op. | ||
| 65 | * | ||
| 66 | * @param BaseQuery $query | ||
| 67 | * @return mixed | ||
| 68 | */ | ||
| 69 | public function updateQuery(&$query) | ||
| 71 | // TODO: Implement updateQuery() method. | ||
| 72 | } | ||
| 73 | } | ||
| 74 |