1 | <?php |
||
12 | class PlaybookCommand extends Command |
||
13 | { |
||
14 | use ConfirmableTrait; |
||
15 | |||
16 | /** |
||
17 | * The name and signature of the console command. |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $signature = 'playbook:run |
||
22 | {playbook? : The name of the playbook you want to run}; |
||
23 | {--force : Force the operation to run when in production}'; |
||
24 | |||
25 | /** |
||
26 | * The console command description. |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $description = 'Run a predefined playbook to fill your application.'; |
||
31 | |||
32 | /** |
||
33 | * List of definitions that has been run. |
||
34 | * |
||
35 | * @var array |
||
36 | */ |
||
37 | private $ranDefenitions = []; |
||
38 | |||
39 | /** |
||
40 | * Execute the console command. |
||
41 | * |
||
42 | * @return mixed |
||
43 | */ |
||
44 | public function handle() |
||
58 | |||
59 | /** |
||
60 | * Run the selected playbook. |
||
61 | * |
||
62 | * @param \Scaling\Playbook\PlaybookDefenition $definition |
||
63 | * @return void |
||
64 | */ |
||
65 | private function runPlaybook(PlaybookDefenition $definition): void |
||
90 | |||
91 | /** |
||
92 | * Get a list of available playbooks. |
||
93 | * |
||
94 | * @return array |
||
95 | */ |
||
96 | private function getAvailablePlaybooks(): array |
||
111 | |||
112 | /** |
||
113 | * Ask which playbook the developer wants to run. |
||
114 | * |
||
115 | * @param array $available |
||
116 | * @return string |
||
117 | */ |
||
118 | private function askWhichBook(array $available): string |
||
122 | |||
123 | /** |
||
124 | * Resolve the definition for the given playbook. |
||
125 | * |
||
126 | * @param Scaling\Playbook\Playbook|Scaling\Playbook\PlaybookDefinition|string $class |
||
127 | * @return \Scaling\Playbook\PlaybookDefenition |
||
128 | */ |
||
129 | private function resolvePlaybook($class): PlaybookDefenition |
||
147 | |||
148 | /** |
||
149 | * Determine if the given definition has ran before. |
||
150 | * |
||
151 | * @param \Scaling\Playbook\PlaybookDefenition $definition |
||
152 | * @return bool |
||
153 | */ |
||
154 | private function definitionHasRun(PlaybookDefenition $definition): bool |
||
158 | } |
||
159 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.