nystudio107 /
craft-autocomplete
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Autocomplete module for Craft CMS |
||
| 4 | * |
||
| 5 | * Provides Twig template IDE autocomplete of Craft CMS & plugin variables |
||
| 6 | * |
||
| 7 | * @link https://nystudio107.com |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 8 | * @link https://putyourlightson.com |
||
| 9 | * @copyright Copyright (c) nystudio107 |
||
|
0 ignored issues
–
show
|
|||
| 10 | * @copyright Copyright (c) PutYourLightsOn |
||
|
0 ignored issues
–
show
|
|||
| 11 | */ |
||
|
0 ignored issues
–
show
|
|||
| 12 | |||
| 13 | namespace nystudio107\autocomplete\console\controllers; |
||
| 14 | |||
| 15 | use nystudio107\autocomplete\Autocomplete; |
||
| 16 | use yii\console\Controller; |
||
| 17 | use yii\console\ExitCode; |
||
| 18 | use yii\helpers\BaseConsole; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Manages autocomplete classes. |
||
| 22 | */ |
||
|
0 ignored issues
–
show
|
|||
| 23 | class AutocompleteController extends Controller |
||
| 24 | { |
||
| 25 | /** |
||
| 26 | * Generates all autocomplete classes that do not already exist. |
||
| 27 | */ |
||
|
0 ignored issues
–
show
|
|||
| 28 | public function actionGenerate(): int |
||
| 29 | { |
||
| 30 | $this->stdout('Generating autocomplete classes ... ', BaseConsole::FG_YELLOW); |
||
| 31 | /* @noinspection NullPointerExceptionInspection */ |
||
| 32 | Autocomplete::getInstance()->generateAutocompleteClasses(); |
||
| 33 | $this->stdout('done' . PHP_EOL, BaseConsole::FG_GREEN); |
||
| 34 | |||
| 35 | return ExitCode::OK; |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Regenerates all autocomplete classes. |
||
| 40 | */ |
||
|
0 ignored issues
–
show
|
|||
| 41 | public function actionRegenerate(): int |
||
| 42 | { |
||
| 43 | $this->stdout('Regenerating autocomplete classes ... ', BaseConsole::FG_YELLOW); |
||
| 44 | /* @noinspection NullPointerExceptionInspection */ |
||
| 45 | Autocomplete::getInstance()->regenerateAutocompleteClasses(); |
||
| 46 | $this->stdout('done' . PHP_EOL, BaseConsole::FG_GREEN); |
||
| 47 | |||
| 48 | return ExitCode::OK; |
||
| 49 | } |
||
| 50 | } |
||
| 51 |