| Total Complexity | 10 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class SetupState extends Menu |
||
| 12 | { |
||
| 13 | 18 | public static function scriptFilter() |
|
| 14 | { |
||
| 15 | 18 | self::saveState(); |
|
| 16 | |||
| 17 | 18 | ScriptFilter::add( |
|
| 18 | 18 | self::stateSaved(), |
|
| 19 | 18 | self::back() |
|
| 20 | ); |
||
| 21 | 18 | } |
|
| 22 | |||
| 23 | 18 | private static function saveState() |
|
| 24 | { |
||
| 25 | 18 | Workflow::disableAllServices(); |
|
| 26 | |||
| 27 | 18 | self::toEnable() ? Workflow::enableService('everhour') : Workflow::disableService('everhour'); |
|
| 28 | 18 | } |
|
| 29 | |||
| 30 | 18 | private static function stateSaved() |
|
| 38 | } |
||
| 39 | |||
| 40 | 18 | private static function stateTitle() |
|
| 43 | } |
||
| 44 | |||
| 45 | 18 | protected static function stateSubtitle() |
|
| 46 | { |
||
| 47 | 18 | return (self::toEnable() ? 'Other services disabled. ' : '') . 'You may press enter to quit the workflow'; |
|
| 48 | } |
||
| 49 | |||
| 50 | 18 | private static function back() |
|
| 51 | { |
||
| 52 | 18 | return Item::create() |
|
| 53 | 18 | ->title('Back') |
|
| 54 | 18 | ->subtitle('Go back to Everhour options') |
|
| 55 | 18 | ->arg('everhour_setup') |
|
| 56 | 18 | ->icon(Icon::create('resources/icons/everhour.png')); |
|
| 57 | } |
||
| 58 | |||
| 59 | 18 | protected static function toEnable() |
|
| 62 | } |
||
| 63 | } |
||
| 64 |