Completed
Pull Request — master (#80)
by Christoffer
02:18
created

ResolveTypeTrait::setResolveType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Digia\GraphQL\Type\Definition;
4
5
trait ResolveTypeTrait
6
{
7
8
    /**
9
     * @var ?callable
10
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment ?callable at position 0 could not be parsed: Unknown type name '?callable' at position 0 in ?callable.
Loading history...
11
    private $resolveTypeFunction;
12
13
    /**
14
     * @param array ...$args
15
     * @return TypeInterface|null
16
     */
17
    public function resolveType(...$args): ?TypeInterface
18
    {
19
        return \call_user_func_array($this->resolveTypeFunction, $args);
20
    }
21
22
    /**
23
     * @param callable|null $resolveTypeFunction
24
     * @return $this
25
     */
26
    protected function setResolveType(?callable $resolveTypeFunction)
27
    {
28
        $this->resolveTypeFunction = $resolveTypeFunction;
29
30
        return $this;
31
    }
32
}
33