| Total Complexity | 13 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class Config |
||
| 11 | { |
||
| 12 | protected const FILE_TEMP = '.tmp'; |
||
| 13 | protected const FILE_EXT = '.png'; |
||
| 14 | |||
| 15 | protected string $descDir = '.txt'; # description dir |
||
| 16 | protected string $descFile = 'index'; # description index filename |
||
| 17 | protected string $descExt = '.dsc'; # description file's extension - add to original name |
||
| 18 | protected string $thumbDir = '.tmb'; # thumbnail dir |
||
| 19 | protected string $thumbExt = self::FILE_EXT; |
||
| 20 | protected string $thumbTemp = self::FILE_TEMP; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param array<string, string|int> $params |
||
| 24 | * @return $this |
||
| 25 | */ |
||
| 26 | 2 | public function setData(array $params = []): self |
|
| 27 | { |
||
| 28 | 2 | $this->descDir = !empty($params['desc_dir']) ? strval($params['desc_dir']) : $this->descDir; |
|
| 29 | 2 | $this->descFile = !empty($params['desc_file']) ? strval($params['desc_file']) : $this->descFile; |
|
| 30 | 2 | $this->descExt = !empty($params['desc_ext']) ? strval($params['desc_ext']) : $this->descExt; |
|
| 31 | 2 | $this->thumbDir = !empty($params['thumb_dir']) ? strval($params['thumb_dir']) : $this->thumbDir; |
|
| 32 | 2 | $this->thumbExt = !empty($params['tmb_ext']) ? strval($params['tmb_ext']) : $this->thumbExt; |
|
| 33 | 2 | $this->thumbTemp = !empty($params['tmb_temp']) ? strval($params['tmb_temp']) : $this->thumbTemp; |
|
| 34 | 2 | return $this; |
|
| 35 | } |
||
| 36 | |||
| 37 | 7 | public function getDescDir(): string |
|
| 38 | { |
||
| 39 | 7 | return $this->descDir; |
|
| 40 | } |
||
| 41 | |||
| 42 | 2 | public function getDescFile(): string |
|
| 43 | { |
||
| 44 | 2 | return $this->descFile; |
|
| 45 | } |
||
| 46 | |||
| 47 | 2 | public function getDescExt(): string |
|
| 48 | { |
||
| 49 | 2 | return $this->descExt; |
|
| 50 | } |
||
| 51 | |||
| 52 | 7 | public function getThumbDir(): string |
|
| 53 | { |
||
| 54 | 7 | return $this->thumbDir; |
|
| 55 | } |
||
| 56 | |||
| 57 | 2 | public function getThumbExt(): string |
|
| 58 | { |
||
| 59 | 2 | return $this->thumbExt; |
|
| 60 | } |
||
| 61 | |||
| 62 | 2 | public function getThumbTemp(): string |
|
| 65 | } |
||
| 66 | } |
||
| 67 |