Completed
Pull Request — master (#37)
by Anton
09:20 queued 02:29
created

StorageConfig   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 52
wmc 4
lcom 1
cbo 2
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A hasServer() 0 4 1
A serverClass() 0 4 1
A serverOptions() 0 4 1
A getBuckets() 0 4 1
1
<?php
2
/**
3
 * Spiral Framework.
4
 *
5
 * @license MIT
6
 * @author  Anton Titov (Wolfy-J)
7
 */
8
namespace Spiral\Storage\Configs;
9
10
use Spiral\Core\InjectableConfig;
11
use Spiral\Core\Traits\Config\AliasTrait;
12
13
/**
14
 * Storage manager configuration.
15
 */
16
class StorageConfig extends InjectableConfig
17
{
18
    use AliasTrait;
19
20
    /**
21
     * Configuration section.
22
     */
23
    const CONFIG = 'storage';
24
25
    /**
26
     * @var array
27
     */
28
    protected $config = [
29
        'servers' => [],
30
        'buckets' => []
31
    ];
32
33
    /**
34
     * @param string $server
35
     * @return bool
36
     */
37
    public function hasServer($server)
38
    {
39
        return isset($this->config['servers'][$server]);
40
    }
41
42
    /**
43
     * @param string $server
44
     * @return string
45
     */
46
    public function serverClass($server)
47
    {
48
        return $this->config['servers'][$server]['class'];
49
    }
50
51
    /**
52
     * @param string $server
53
     * @return array
54
     */
55
    public function serverOptions($server)
56
    {
57
        return $this->config['servers'][$server];
58
    }
59
60
    /**
61
     * @return array
62
     */
63
    public function getBuckets()
64
    {
65
        return $this->config['buckets'];
66
    }
67
}