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

StorageConfig::hasServer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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
}