| Total Complexity | 7 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class Missing extends Command |
||
| 9 | { |
||
| 10 | protected $signature = 'lang:missing'; |
||
| 11 | |||
| 12 | protected $description = 'Helps identify missing localizations for publication.'; |
||
| 13 | |||
| 14 | protected $hidden = true; |
||
| 15 | |||
| 16 | public function handle(MissingSupport $missing) |
||
| 17 | { |
||
| 18 | if ($this->missingError($missing) || $this->unnecessaryError($missing)) { |
||
| 19 | return; |
||
| 20 | } |
||
| 21 | |||
| 22 | $this->info('Congratulations! All localizations are available!'); |
||
| 23 | } |
||
| 24 | |||
| 25 | protected function missingError(MissingSupport $missing): bool |
||
| 26 | { |
||
| 27 | return $this->isError($missing->missing(), 'We found the following localizations unavailable for installation:'); |
||
| 28 | } |
||
| 29 | |||
| 30 | protected function unnecessaryError(MissingSupport $missing): bool |
||
| 31 | { |
||
| 32 | return $this->isError($missing->unnecessary(), 'We found the following unnecessary localizations:'); |
||
| 33 | } |
||
| 34 | |||
| 35 | protected function isError(array $locales, string $message): bool |
||
| 45 | } |
||
| 46 | } |
||
| 47 |