Test Setup Failed
Push — master ( 050b68...43996d )
by Kirill
03:02
created

Context::add()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * This file is part of Railt 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 Railt\SDL\Backend\Context;
13
14
use Railt\TypeSystem\Schema;
15
16
/**
17
 * Class Context
18
 */
19
abstract class Context implements ContextInterface
20
{
21
    /**
22
     * @var Schema
23
     */
24
    protected Schema $schema;
25
26
    /**
27
     * @var array|LocalContextInterface[]
28
     */
29
    protected array $contexts = [];
30
31
    /**
32
     * Context constructor.
33
     *
34
     * @param Schema $schema
35
     */
36
    public function __construct(Schema $schema)
37
    {
38
        $this->schema = $schema;
39
    }
40
41
    /**
42
     * @param Schema $schema
43
     * @return void
44
     */
45
    public function setSchema(Schema $schema): void
46
    {
47
        $this->schema = $schema;
48
    }
49
50
    /**
51
     * @return Schema
52
     */
53
    public function getSchema(): Schema
54
    {
55
        return $this->schema;
56
    }
57
58
    /**
59
     * @param LocalContextInterface $context
60
     * @return void
61
     */
62
    public function add(LocalContextInterface $context): void
63
    {
64
        $this->contexts[$context->getName()] = $context;
65
    }
66
}
67