These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Encore\Admin\Form\Field; |
||
4 | |||
5 | use Symfony\Component\HttpFoundation\File\UploadedFile; |
||
6 | |||
7 | class MultipleImage extends MultipleFile |
||
8 | { |
||
9 | use ImageField; |
||
10 | |||
11 | /** |
||
12 | * {@inheritdoc} |
||
13 | */ |
||
14 | protected $view = 'admin::form.multiplefile'; |
||
15 | |||
16 | /** |
||
17 | * Validation rules. |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $rules = 'image'; |
||
22 | |||
23 | /** |
||
24 | * Prepare for each file. |
||
25 | * |
||
26 | * @param UploadedFile $image |
||
27 | * |
||
28 | * @return mixed|string |
||
29 | */ |
||
30 | View Code Duplication | protected function prepareForeach(UploadedFile $image = null) |
|
0 ignored issues
–
show
|
|||
31 | { |
||
32 | $this->name = $this->getStoreName($image); |
||
33 | |||
34 | $this->callInterventionMethods($image->getRealPath()); |
||
35 | |||
36 | return tap($this->upload($image), function () { |
||
37 | $this->name = null; |
||
38 | }); |
||
39 | } |
||
40 | } |
||
41 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.