Completed
Pull Request — master (#25)
by David
01:24
created

FooType::customField()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
4
namespace TheCodingMachine\GraphQL\Controllers\Fixtures\Types;
5
6
use TheCodingMachine\GraphQL\Controllers\AbstractAnnotatedObjectType;
7
use TheCodingMachine\GraphQL\Controllers\Annotations\Right;
8
use TheCodingMachine\GraphQL\Controllers\Annotations\SourceField;
9
use TheCodingMachine\GraphQL\Controllers\Annotations\Field;
10
use TheCodingMachine\GraphQL\Controllers\Annotations\Type;
11
use TheCodingMachine\GraphQL\Controllers\Fixtures\TestObject;
12
use TheCodingMachine\GraphQL\Controllers\Registry\Registry;
13
use TheCodingMachine\GraphQL\Controllers\Registry\RegistryInterface;
14
use Youshido\GraphQL\Config\Object\ObjectTypeConfig;
15
use Youshido\GraphQL\Type\Object\AbstractObjectType;
16
17
/**
18
 * @Type(class=TestObject::class)
19
 * @SourceField(name="test")
20
 * @SourceField(name="testBool", logged=true)
21
 * @SourceField(name="testRight", right=@Right(name="FOOBAR"))
22
 */
23
class FooType extends AbstractAnnotatedObjectType
24
{
25
    public function __construct(RegistryInterface $registry)
26
    {
27
        parent::__construct($registry);
28
    }
29
30
    /**
31
     * @Field()
32
     * @param TestObject $test
33
     * @param string $param
34
     * @return string
35
     */
36
    public function customField(TestObject $test, string $param = 'foo'): string
37
    {
38
        return $test->getTest().$param;
39
    }
40
}
41