| Total Complexity | 7 |
| Total Lines | 63 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 17 | class MaintenanceFormWidget extends Widget |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var bool |
||
| 21 | */ |
||
| 22 | public $status = true; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var FileStateForm |
||
| 26 | */ |
||
| 27 | public $model; |
||
| 28 | |||
| 29 | public function init() |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @return string|void |
||
| 37 | */ |
||
| 38 | public function run() |
||
| 39 | { |
||
| 40 | if ($this->status === true) { |
||
| 41 | $this->registerResource(); |
||
| 42 | echo $this->render('maintenance-form', ['model' => $this->model]); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @return array |
||
| 48 | */ |
||
| 49 | protected function getOptions() |
||
| 50 | { |
||
| 51 | return [ |
||
| 52 | 'modeOn' => Maintenance::STATUS_CODE_MAINTENANCE, |
||
| 53 | 'modeOff' => Maintenance::STATUS_CODE_OK |
||
| 54 | ]; |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Register resource |
||
| 59 | */ |
||
| 60 | protected function registerResource() |
||
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | * @return FileStateForm |
||
| 73 | */ |
||
| 74 | protected function findModel() |
||
| 82 |