Completed
Push — master ( 692093...daa27a )
by Vitaly
02:57
created

InjectArgument::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1.125

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 8
ccs 2
cts 4
cp 0.5
rs 9.4285
c 2
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1.125
1
<?php declare(strict_types = 1);
2
/**
3
 * Created by Vitaly Iegorov <[email protected]>.
4
 * on 07.08.16 at 15:46
5
 */
6
namespace samsonframework\container\annotation;
7
8
use samsonframework\container\configurator\InjectableArgumentConfigurator;
9
10
/**
11
 * Method argument injection annotation.
12
 *
13
 * @author Vitaly Egorov <[email protected]>
14
 *
15
 * @Annotation
16
 */
17
class InjectArgument extends InjectableArgumentConfigurator
18
{
19
    use AnnotationValueTrait;
20
21
    /**
22
     * InjectArgument constructor.
23
     *
24
     * @param array $valueOrValues
25
     *
26
     * @throws \InvalidArgumentException
27
     */
28 13
    public function __construct(array $valueOrValues)
29
    {
30
        // Parse argument injection data
31 13
        list($argumentName, $argumentType) = each($this->parseAnnotationValue($valueOrValues));
0 ignored issues
show
Bug introduced by
$this->parseAnnotationValue($valueOrValues) cannot be passed to each() as the parameter $array expects a reference.
Loading history...
32
33
        // Pass to injectable argument configurator
34
        parent::__construct($argumentName, $argumentType);
35
    }
36
}
37