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

FooType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 3
dl 0
loc 16
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A customField() 0 3 1
A __construct() 0 3 1
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