Completed
Push — master ( 611e0d...3b7232 )
by Kirill
02:21
created

ArgumentInvocation   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 48
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getType() 0 4 1
A getValue() 0 4 1
A getTypeDefinition() 0 9 1
1
<?php
2
/**
3
 * This file is part of Railt package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Railt\Reflection\Invocation\Dependent;
11
12
use Railt\Reflection\Contracts\Definition\Behaviour\ProvidesArguments;
13
use Railt\Reflection\Contracts\Definition\TypeDefinition;
14
use Railt\Reflection\Contracts\Invocation\Dependent\ArgumentInvocation as ArgumentInvocationInterface;
15
use Railt\Reflection\Contracts\Invocation\TypeInvocation;
16
use Railt\Reflection\Contracts\Type;
17
use Railt\Reflection\Definition\Dependent\ArgumentDefinition;
18
use Railt\Reflection\Document;
19
20
/**
21
 * Class ArgumentInvocation
22
 */
23
class ArgumentInvocation extends AbstractDependentTypeInvocation implements ArgumentInvocationInterface
24
{
25
    /**
26
     * @var mixed
27
     */
28
    protected $value;
29
30
    /**
31
     * ArgumentInvocation constructor.
32
     * @param TypeInvocation $parent
33
     * @param Document $document
34
     * @param string $name
35
     * @param mixed $value
36
     */
37
    public function __construct(TypeInvocation $parent, Document $document, string $name, $value)
0 ignored issues
show
Unused Code introduced by
The parameter $value is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
    {
39
        parent::__construct($parent, $document, $name);
40
    }
41
42
    /**
43
     * @return Type
44
     */
45
    public static function getType(): Type
46
    {
47
        return ArgumentDefinition::getType();
48
    }
49
50
    /**
51
     * @return mixed
52
     */
53
    public function getValue()
54
    {
55
        return $this->value;
56
    }
57
58
    /**
59
     * @return TypeDefinition
60
     */
61
    public function getTypeDefinition(): TypeDefinition
62
    {
63
        /** @var ProvidesArguments $parent */
64
        $parent = $this->getParent()->getTypeDefinition();
0 ignored issues
show
Bug introduced by
The method getTypeDefinition() does not exist on Railt\Reflection\Contrac...vocation\TypeInvocation. Did you maybe mean getType()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
65
66
        \assert($parent instanceof ProvidesArguments);
67
68
        return $parent->getArgumentDefinition($this->name);
0 ignored issues
show
Bug introduced by
The method getArgumentDefinition() does not exist on Railt\Reflection\Contrac...viour\ProvidesArguments. Did you maybe mean getArgument()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
69
    }
70
}
71