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

Service   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 8
Bugs 2 Features 2
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 20
ccs 4
cts 4
cp 1
rs 10
c 8
b 2
f 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 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\ServiceConfigurator;
11
12
/**
13
 * Service configurator annotation class.
14
 * @see    \samsonframework\container\configurator\ServiceConfigurator
15
 *
16
 * @author Vitaly Egorov <[email protected]>
17
 *
18
 * @Annotation
19
 */
20
class Service extends ServiceConfigurator
21
{
22
    use AnnotationValueTrait;
23
24
    /**
25
     * Service annotation configurator constructor.
26
     *
27
     * @param string|array $valueOrValues Service unique name
28
     *
29
     * @throws \InvalidArgumentException
30
     */
31 9
    public function __construct($valueOrValues)
32
    {
33
        // Parse annotation value
34 9
        $serviceNameData = $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 service configurator
37 9
        parent::__construct(array_shift($serviceNameData));
38 9
    }
39
}
40