| Total Complexity | 13 |
| Total Lines | 80 |
| Duplicated Lines | 0 % |
| Coverage | 60.71% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | abstract class Picture implements \JsonSerializable |
||
| 8 | { |
||
| 9 | const UPLOAD_DIR = 'images/uploads'; |
||
| 10 | |||
| 11 | /** @var string **/ |
||
| 12 | protected $name; |
||
| 13 | /** @var string **/ |
||
| 14 | protected $path; |
||
| 15 | /** @var File */ |
||
|
|
|||
| 16 | protected $file; |
||
| 17 | /** @var resource **/ |
||
| 18 | protected $temp; |
||
| 19 | |||
| 20 | 1 | public function setName(string $name): Picture |
|
| 21 | { |
||
| 22 | 1 | $this->name = $name; |
|
| 23 | |||
| 24 | 1 | return $this; |
|
| 25 | } |
||
| 26 | |||
| 27 | public function getName(): string |
||
| 28 | { |
||
| 29 | return $this->name; |
||
| 30 | } |
||
| 31 | |||
| 32 | public function setPath(string $path): Picture |
||
| 33 | { |
||
| 34 | $this->path = $path; |
||
| 35 | |||
| 36 | return $this; |
||
| 37 | } |
||
| 38 | |||
| 39 | public function getPath(): string |
||
| 40 | { |
||
| 41 | return $this->path; |
||
| 42 | } |
||
| 43 | |||
| 44 | 1 | public function setFile(UploadedFile $file = null): Picture |
|
| 45 | { |
||
| 46 | 1 | $this->file = $file; |
|
| 47 | // check if we have an old image path |
||
| 48 | 1 | if ($this->file !== null && is_file($this->getAbsolutePath())) { |
|
| 49 | // store the old name to delete after the update |
||
| 50 | $this->temp = $this->getAbsolutePath(); |
||
| 51 | $this->path = null; |
||
| 52 | } |
||
| 53 | 1 | return $this; |
|
| 54 | } |
||
| 55 | |||
| 56 | public function getFile(): UploadedFile |
||
| 57 | { |
||
| 58 | return $this->file; |
||
| 59 | } |
||
| 60 | |||
| 61 | 1 | public function getAbsolutePath(): string |
|
| 64 | } |
||
| 65 | |||
| 66 | 1 | public function getWebPath(): string |
|
| 67 | { |
||
| 68 | 1 | return $this->getUploadDir() . '/' . $this->path; |
|
| 69 | } |
||
| 70 | |||
| 71 | 1 | public function getUploadDir(): string |
|
| 76 | } |
||
| 77 | |||
| 78 | 1 | public function getUploadRootDir(): string |
|
| 79 | { |
||
| 80 | 1 | return __DIR__ . '/../../public/' . self::UPLOAD_DIR; |
|
| 81 | } |
||
| 82 | |||
| 83 | 1 | public function jsonSerialize(): array |
|
| 87 | ]; |
||
| 88 | } |
||
| 89 | |||
| 90 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths