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