Conditions | 5 |
Paths | 4 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
39 | public function getMediaItems(): Collection |
||
40 | { |
||
41 | $modelType = $this->argument('modelType'); |
||
42 | $collectionName = $this->argument('collectionName'); |
||
43 | |||
44 | if (! is_null($modelType) && ! is_null($collectionName)) { |
||
45 | return $this->mediaRepository->getByModelTypeAndCollectionName( |
||
46 | $modelType, |
||
|
|||
47 | $collectionName |
||
48 | ); |
||
49 | } |
||
50 | |||
51 | if (! is_null($modelType)) { |
||
52 | return $this->mediaRepository->getByModelType($modelType); |
||
53 | } |
||
54 | |||
55 | if (! is_null($collectionName)) { |
||
56 | return $this->mediaRepository->getByCollectionName($collectionName); |
||
57 | } |
||
58 | |||
59 | return $this->mediaRepository->all(); |
||
60 | } |
||
61 | } |
||
62 |
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.