Config::getDescFile()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace kalanis\kw_files\Extended;
4
5
6
/**
7
 * Class Config
8
 * Work with extended dirs - which values are which
9
 */
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
63
    {
64 2
        return $this->thumbTemp;
65
    }
66
}
67