Passed
Push — master ( 3bddf7...37f0e3 )
by Max
07:30
created

BasicConfig::getDefaultDataProviderClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
declare(strict_types=1);
4
5
namespace EasyDictionary;
6
7
use EasyDictionary\DataProvider\Simple as SimpleDataProvider;
8
use EasyDictionary\Dictionary\Simple as SimpleDictionary;
9
use EasyDictionary\Interfaces\ConfigInterface;
10
use Psr\SimpleCache\CacheInterface;
11
12
/**
13
 * Class BasicConfig
14
 *
15
 * @package EasyDictionary\Dictionary
16
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
17
class BasicConfig implements ConfigInterface
18
{
19
    protected $defaultDataProviderClass = SimpleDataProvider::class;
20
    protected $defaultDictionaryClass = SimpleDictionary::class;
21
    protected $dictionaryConfig = [];
22
    protected $defaultView = null;
23
    protected $caches = [];
24
25
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
26
     * @return string
27
     */
28
    public function getDefaultDataProviderClass(): string
29
    {
30
        return $this->defaultDataProviderClass;
31
    }
32
33
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
34
     * @return string
35
     */
36
    public function getDefaultDictionaryClass(): string
37
    {
38
        return $this->defaultDictionaryClass;
39
    }
40
41
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
42
     * @return array
43
     */
44
    public function getDictionaryConfig(): array
45
    {
46
        return $this->dictionaryConfig;
47
    }
48
49
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
50
     * @param array $dictionaryConfig
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
51
     * @return $this
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
52
     */
53
    public function setDictionaryConfig(array $dictionaryConfig)
54
    {
55
        $this->dictionaryConfig = $dictionaryConfig;
56
57
        return $this;
58
    }
59
60
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
61
     * @return callable
62
     */
63
    public function getDefaultView(): ?callable
64
    {
65
        return $this->defaultView;
66
    }
67
68
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
69
     * @param callable $view
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
70
     * @return $this
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
71
     */
72
    public function setDefaultView(callable $view)
73
    {
74
        $this->defaultView = $view;
75
76
        return $this;
77
    }
78
79
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
80
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
81
     * @return null|CacheInterface
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
82
     */
83
    public function getCache(string $name): ?CacheInterface
84
    {
85
        return $this->caches[$name] ?? null;
86
    }
87
88
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
89
     * @param CacheInterface $cache
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
90
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 9 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
91
     * @return $this
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
92
     */
93
    public function addCache(CacheInterface $cache, string $name)
94
    {
95
        $this->caches[$name] = $cache;
96
97
        return $this;
98
    }
99
}
100