Completed
Push — master ( f8702a...461e07 )
by Alexandr
04:08
created

BannerType::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
/**
3
 * BannerType.php
4
 */
5
6
namespace Examples\Blog\Schema;
7
8
use Youshido\GraphQL\Type\Config\TypeConfigInterface;
9
use Youshido\GraphQL\Type\NonNullType;
10
use Youshido\GraphQL\Type\Object\AbstractObjectType;
11
use Youshido\GraphQL\Type\Scalar\StringType;
12
13
class BannerType extends AbstractObjectType
14
{
15
    public function build(TypeConfigInterface $config)
16
    {
17
        $config
18
            ->addField('title', new NonNullType(new StringType()))
19
            ->addField('summary', new StringType())
20
            ->addField('imageLink', new StringType());
21
    }
22
23
    public function resolve($value = null, $args = [], $type = null)
24
    {
25
        return DataProvider::getBanner(1);
26
    }
27
28
    public function getInterfaces()
29
    {
30
        return [new ContentBlockInterface()];
31
    }
32
}
33