| Conditions | 7 |
| Paths | 7 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 56 |
| Changes | 0 | ||
| 1 | <?php |
||
| 60 | public function getUrl($model) |
||
| 61 | { |
||
| 62 | if (is_null($model)) { |
||
| 63 | return null; |
||
| 64 | } |
||
| 65 | |||
| 66 | $filepath = $model->{$this->name()}; |
||
| 67 | if (!$filepath) { |
||
| 68 | return null; |
||
| 69 | } |
||
| 70 | |||
| 71 | $disk = IlluminateStorage::disk($this->getDisk()); |
||
| 72 | |||
| 73 | $paths = []; |
||
| 74 | if (is_array($filepath)) { |
||
| 75 | foreach ($filepath as $path) { |
||
| 76 | $paths[] = $this->isEncode() ? $path : $disk->url($path); |
||
| 77 | } |
||
| 78 | return $paths; |
||
| 79 | } |
||
| 80 | |||
| 81 | return $this->isEncode() ? $filepath : $disk->url($filepath); |
||
| 82 | } |
||
| 83 | } |
||
| 84 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@returnannotation as described here.