1 | <?php |
||
12 | class RegenerateCommand extends Command |
||
13 | { |
||
14 | /** |
||
15 | * The console command name. |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $signature = 'medialibrary:regenerate {modelType?} {--ids=*}'; |
||
20 | |||
21 | /** |
||
22 | * The console command description. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $description = 'Regenerate the derived images of media'; |
||
27 | |||
28 | /** |
||
29 | * @var \Spatie\MediaLibrary\MediaRepository |
||
30 | */ |
||
31 | protected $mediaRepository; |
||
32 | |||
33 | /** |
||
34 | * @var \Spatie\MediaLibrary\FileManipulator |
||
35 | */ |
||
36 | protected $fileManipulator; |
||
37 | |||
38 | /** |
||
39 | * RegenerateCommand constructor. |
||
40 | * |
||
41 | * @param MediaRepository $mediaRepository |
||
42 | * @param FileManipulator $fileManipulator |
||
43 | */ |
||
44 | public function __construct(MediaRepository $mediaRepository, FileManipulator $fileManipulator) |
||
45 | { |
||
46 | parent::__construct(); |
||
47 | |||
48 | $this->mediaRepository = $mediaRepository; |
||
49 | $this->fileManipulator = $fileManipulator; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Handle regeneration. |
||
54 | */ |
||
55 | public function handle() |
||
64 | |||
65 | /** |
||
66 | * @return \Illuminate\Database\Eloquent\Collection |
||
67 | */ |
||
68 | public function getMediaToBeRegenerated() |
||
88 | } |
||
89 |
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.