BookStoreSchema   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 8

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 8
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 13 1
1
<?php
2
/**
3
 * This file is a part of GraphQL project.
4
 *
5
 * @author Alexandr Viniychuk <[email protected]>
6
 * created: 4/23/17 10:43 PM
7
 */
8
9
namespace Examples\BookStore\Schema;
10
11
12
use Examples\BookStore\DataProvider;
13
use Examples\BookStore\Schema\Field\Book\RecentBooksField;
14
use Examples\BookStore\Schema\Field\CategoriesField;
15
use Examples\BookStore\Schema\Type\AuthorType;
16
use Youshido\GraphQL\Config\Schema\SchemaConfig;
17
use Youshido\GraphQL\Schema\AbstractSchema;
18
use Youshido\GraphQL\Type\ListType\ListType;
19
20
class BookStoreSchema extends AbstractSchema
21
{
22
    public function build(SchemaConfig $config)
23
    {
24
        $config->getQuery()->addFields([
25
            'authors' => [
26
                'type'    => new ListType(new AuthorType()),
27
                'resolve' => function () {
28
                    return DataProvider::getAuthors();
29
                }
30
            ],
31
            new RecentBooksField(),
32
            new CategoriesField(),
33
        ]);
34
    }
35
36
}