1 | <?php |
||
10 | class PlaybookCommand extends Command |
||
11 | { |
||
12 | /** |
||
13 | * The name and signature of the console command. |
||
14 | * |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $signature = 'playbook:run {playbook?}'; |
||
18 | |||
19 | /** |
||
20 | * The console command description. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $description = 'Run a predefined playbook to fill your application.'; |
||
25 | |||
26 | /** |
||
27 | * List of definitions that has been run. |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | private $ranDefenitions = []; |
||
32 | |||
33 | /** |
||
34 | * Execute the console command. |
||
35 | * |
||
36 | * @return mixed |
||
37 | */ |
||
38 | public function handle() |
||
54 | |||
55 | /** |
||
56 | * Run the selected playbook. |
||
57 | * |
||
58 | * @param \Scaling\Playbook\PlaybookDefenition $definition |
||
59 | * @return void |
||
60 | */ |
||
61 | private function runPlaybook(PlaybookDefenition $definition): void |
||
86 | |||
87 | /** |
||
88 | * Get a list of available playbooks. |
||
89 | * |
||
90 | * @return array |
||
91 | */ |
||
92 | private function getAvailablePlaybooks(): array |
||
102 | |||
103 | /** |
||
104 | * Ask which playbook the developer wants to run. |
||
105 | * |
||
106 | * @param array $available |
||
107 | * @return string |
||
108 | */ |
||
109 | private function askWhichBook(array $available): string |
||
113 | |||
114 | /** |
||
115 | * Resolve the definition for the given playbook. |
||
116 | * |
||
117 | * @param Scaling\Playbook\Playbook|Scaling\Playbook\PlaybookDefinition|string $class |
||
118 | * @return \Scaling\Playbook\PlaybookDefenition |
||
119 | */ |
||
120 | private function resolvePlaybook($class): PlaybookDefenition |
||
138 | |||
139 | /** |
||
140 | * Determine if the given definition has ran before. |
||
141 | * |
||
142 | * @param \Scaling\Playbook\PlaybookDefenition $definition |
||
143 | * @return bool |
||
144 | */ |
||
145 | private function definitionHasRun(PlaybookDefenition $definition): bool |
||
149 | |||
150 | /** |
||
151 | * Determine if the action is allowed in a production environment. |
||
152 | * |
||
153 | * @return bool |
||
154 | */ |
||
155 | private function isAllowedInProduction(): bool |
||
163 | } |
||
164 |
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.