| Total Complexity | 5 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 7 | trait FileRules |
||
| 8 | { |
||
| 9 | public function image() |
||
| 12 | } |
||
| 13 | |||
| 14 | /* |
||
| 15 | * Define dimensions with the properties as specified in the laravel documentation but in a kay value array |
||
| 16 | * e.g. ["max_height" => 50] |
||
| 17 | */ |
||
| 18 | public function dimensions(array $dimensions) |
||
| 19 | { |
||
| 20 | $dimensions = collect($dimensions) |
||
| 21 | ->map(function ($key, $value) { |
||
| 22 | return "$key=$value"; |
||
| 23 | }) |
||
| 24 | ->implode(',', ''); |
||
| 25 | |||
| 26 | return $this->rule('mimes:' . $dimensions); |
||
| 27 | } |
||
| 28 | |||
| 29 | public function mimes(string ...$extensions) |
||
| 30 | { |
||
| 31 | return $this->rule('mimes:' . implode(',', $extensions)); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function mimeTypes(string ...$types) |
||
| 35 | { |
||
| 36 | return $this->rule('mimetypes:' . implode(',', $types)); |
||
| 37 | } |
||
| 38 | |||
| 39 | public function size(int $size) |
||
| 42 | } |
||
| 43 | } |