Completed
Push — master ( daa27a...019907 )
by Vitaly
03:25
created

Scope::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 1
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 3
b 0
f 1
cc 1
eloc 3
nc 1
nop 1
crap 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\annotation;
9
10
use samsonframework\container\configurator\ScopeConfigurator;
11
12
/**
13
 * Scope configurator annotation class.
14
 * @see    \samsonframework\container\configurator\ScopeConfigurator
15
 *
16
 * @author Vitaly Egorov <[email protected]>
17
 *
18
 * @Annotation
19
 */
20
class Scope extends ScopeConfigurator
21
{
22
    use AnnotationValueTrait;
23
24
    /**
25
     * Scope annotation configurator constructor.
26
     *
27
     * @param string|array $valueOrValues Service unique name
28
     *
29
     * @throws \InvalidArgumentException
30
     */
31 11
    public function __construct($valueOrValues)
32
    {
33
        // Parse annotation value
34 11
        $scopeNameData = $this->parseAnnotationValue($valueOrValues);
0 ignored issues
show
Bug introduced by
It seems like $valueOrValues defined by parameter $valueOrValues on line 31 can also be of type string; however, samsonframework\containe...:parseAnnotationValue() does only seem to accept array, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
35
36
        // Pass to scope configurator
37 11
        parent::__construct(array_shift($scopeNameData));
38 11
    }
39
}
40