| Total Complexity | 10 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class RepeaterFile |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var File |
||
| 12 | */ |
||
| 13 | private $field; |
||
| 14 | |||
| 15 | public function __construct(File $field) |
||
| 16 | { |
||
| 17 | $this->field = $field; |
||
| 18 | } |
||
| 19 | |||
| 20 | public function __call($method, $parameters) |
||
| 23 | } |
||
| 24 | |||
| 25 | public function getPaths($model): array |
||
| 26 | { |
||
| 27 | if (is_null($model)) { |
||
| 28 | return []; |
||
| 29 | } |
||
| 30 | |||
| 31 | $filepath = $this->getAttribute($model); |
||
|
|
|||
| 32 | // FIXME: mb change structure for storing files data? |
||
| 33 | $filepath = $this->sanitizeRepeaterValue($filepath); |
||
| 34 | if (!$filepath) { |
||
| 35 | return []; |
||
| 36 | } |
||
| 37 | |||
| 38 | return is_array($filepath) ? $filepath : [$filepath]; |
||
| 39 | } |
||
| 40 | |||
| 41 | private function sanitizeRepeaterValue($filepath) |
||
| 48 | } |
||
| 49 | } |
||
| 50 |