ScopeConfigurator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A toClassMetadata() 0 5 1
1
<?php declare(strict_types = 1);
2
/**
3
 * Created by PhpStorm.
4
 * User: root
5
 * Date: 27.07.2016
6
 * Time: 1:55.
7
 */
8
namespace samsonframework\container\configurator;
9
10
use samsonframework\container\metadata\ClassMetadata;
11
12
/**
13
 * Scope class configurator.
14
 *
15
 * This configurator adds class to container scopes.
16
 * @see    samsonframework\container\Container::$scopes
17
 *
18
 * @author Vitaly Egorov <[email protected]>
19
 */
20
class ScopeConfigurator implements ClassConfiguratorInterface
21
{
22
    /** @var string Class scope name */
23
    protected $scopeName;
24
25
    /**
26
     * ScopeConfigurator constructor.
27
     *
28
     * @param string $scopeData Class scope name
29
     */
30
    public function __construct(string $scopeData)
31
    {
32
        $this->scopeName = $scopeData;
33
    }
34
35
    /** {@inheritdoc} */
36
    public function toClassMetadata(ClassMetadata $classMetadata)
37
    {
38
        // Add scope name to class scopes collection
39
        $classMetadata->scopes[] = $this->scopeName;
40
    }
41
}
42