Completed
Branch develop (f7dc53)
by Anton
05:49
created

Context   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 44
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getFunction() 0 4 1
A getParameter() 0 4 1
1
<?php
2
/**
3
 * Spiral Framework.
4
 *
5
 * @license   MIT
6
 * @author    Anton Titov (Wolfy-J)
7
 */
8
namespace Spiral\Core\Container;
9
10
/**
11
 * Provided to method or constructor which declares such dependency.
12
 */
13
final class Context
14
{
15
    /**
16
     * @var \ReflectionFunctionAbstract
17
     */
18
    private $function = null;
19
20
    /**
21
     * @var \ReflectionParameter|null
22
     */
23
    private $parameter = null;
24
25
    /**
26
     * @param \ReflectionFunctionAbstract $function
27
     * @param \ReflectionParameter|null   $parameter
28
     */
29
    public function __construct(
30
        \ReflectionFunctionAbstract $function,
31
        \ReflectionParameter $parameter = null
32
    ) {
33
        $this->function = $function;
34
        $this->parameter = $parameter;
35
    }
36
37
    /**
38
     * Function or method or constructor.
39
     *
40
     * @return \ReflectionFunctionAbstract
41
     */
42
    public function getFunction()
43
    {
44
        return $this->function;
45
    }
46
47
    /**
48
     * Can be empty.
49
     *
50
     * @return null|\ReflectionParameter
51
     */
52
    public function getParameter()
53
    {
54
        return $this->parameter;
55
    }
56
}