Passed
Pull Request — master (#407)
by Kirill
06:59
created

BucketInfo::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 3
dl 0
loc 7
rs 10
1
<?php
2
3
/**
4
 * This file is part of Spiral Framework package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Storage\Config\DTO;
13
14
use Spiral\Storage\Config\DTO\FileSystemInfo\FileSystemInfoInterface;
15
use Spiral\Storage\Config\DTO\Traits\OptionsTrait;
16
17
class BucketInfo implements BucketInfoInterface
18
{
19
    use OptionsTrait;
20
21
    /**
22
     * @var string
23
     */
24
    public $name;
25
26
    /**
27
     * @var string
28
     */
29
    public $server;
30
31
    /**
32
     * @var FileSystemInfoInterface|null
33
     */
34
    protected $fileSystemInfo = null;
35
36
    /**
37
     * @param string $name
38
     * @param string $server
39
     * @param array $info
40
     */
41
    public function __construct(string $name, string $server, array $info = [])
42
    {
43
        $this->name = $name;
44
        $this->server = $server;
45
46
        if (array_key_exists(static::OPTIONS_KEY, $info)) {
47
            $this->options = $info[static::OPTIONS_KEY];
48
        }
49
    }
50
51
    /**
52
     * @inheritDoc
53
     */
54
    public function getServer(): string
55
    {
56
        return $this->server;
57
    }
58
59
    /**
60
     * @inheritDoc
61
     */
62
    public function setFileSystemInfo(FileSystemInfoInterface $fileSystemInfo): BucketInfoInterface
63
    {
64
        $this->fileSystemInfo = $fileSystemInfo;
65
66
        return $this;
67
    }
68
69
    /**
70
     * @inheritDoc
71
     */
72
    public function getFileSystemInfo(): ?FileSystemInfoInterface
73
    {
74
        return $this->fileSystemInfo;
75
    }
76
}
77