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

BannerType   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 7

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 0
cbo 7
dl 0
loc 20
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 7 1
A resolve() 0 4 1
A getInterfaces() 0 4 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