Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
29 | 2 | public function select($id = null) |
|
30 | { |
||
31 | 2 | if ($id instanceof UploadedFile) { |
|
32 | 2 | if (!$id->isValid()) { |
|
33 | 1 | throw new \InvalidArgumentException('Upload was not successful'); |
|
34 | } |
||
35 | |||
36 | 1 | $newFile = $id->move($this->targetDirectory, $this->generateTargetFilename($id)); |
|
37 | |||
38 | 1 | $selection = new StorageSelection( |
|
39 | 1 | new \SplFileInfo($newFile), |
|
40 | 1 | $this->targetDirectory.'/'.$newFile->getFilename(), |
|
41 | 1 | $id->getClientOriginalName()); |
|
42 | |||
43 | 1 | return $selection; |
|
44 | } |
||
45 | |||
46 | return parent::select($id); |
||
47 | } |
||
48 | |||
54 |