Test Failed
Push — master ( 1ff1d8...4bdf7b )
by Kirill
03:34
created

InputInvocation   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 31
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getName() 0 4 1
A getType() 0 4 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;
11
12
use Railt\Reflection\Contracts\Document as DocumentInterface;
13
use Railt\Reflection\Contracts\Invocation\InputInvocation as InputInvocationInterface;
14
use Railt\Reflection\Contracts\TypeInterface as TypeInterface;
15
use Railt\Reflection\Document;
16
use Railt\Reflection\Invocation\Behaviour\HasArguments;
17
use Railt\Reflection\Type;
18
19
/**
20
 * Class InputInvocation
21
 */
22
class InputInvocation extends AbstractTypeInvocation implements InputInvocationInterface
23
{
24
    use HasArguments;
25
26
    /**
27
     * InputInvocation constructor.
28
     * @param Document|DocumentInterface $document
29
     * @param string|null $name
30
     */
31
    public function __construct(Document $document, string $name = null)
32
    {
33
        $this->document = $document;
34
        $this->name = $name;
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function getName(): string
41
    {
42
        return (string)($this->name ?? ':anonymous');
43
    }
44
45
    /**
46
     * @return TypeInterface
47
     */
48
    public static function getType(): TypeInterface
49
    {
50
        return Type::of(Type::INPUT_OBJECT);
51
    }
52
}
53