Completed
Push — master ( f9f0ef...24a695 )
by Portey
05:15
created

ObjectTypeConfig   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 7
Bugs 2 Features 1
Metric Value
wmc 3
c 7
b 2
f 1
lcom 0
cbo 3
dl 0
loc 29
ccs 14
cts 14
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getRules() 0 11 1
A build() 0 5 1
A getInterfaces() 0 4 1
1
<?php
2
/*
3
* This file is a part of graphql-youshido project.
4
*
5
* @author Alexandr Viniychuk <[email protected]>
6
* created: 11/27/15 2:32 AM
7
*/
8
9
namespace Youshido\GraphQL\Type\Config\Object;
10
11
use Youshido\GraphQL\Type\Config\Config;
12
use Youshido\GraphQL\Type\Config\TypeConfigInterface;
13
use Youshido\GraphQL\Type\Config\Traits\ArgumentsAwareTrait;
14
use Youshido\GraphQL\Type\Config\Traits\FieldsAwareTrait;
15
use Youshido\GraphQL\Type\TypeMap;
16
17
class ObjectTypeConfig extends Config implements TypeConfigInterface
18
{
19
20
    use FieldsAwareTrait, ArgumentsAwareTrait;
21
22 23
    public function getRules()
23
    {
24
        return [
25 23
            'name'        => ['type' => TypeMap::TYPE_STRING, 'required' => true],
26 23
            'description' => ['type' => TypeMap::TYPE_STRING],
27 23
            'fields'      => ['type' => TypeMap::TYPE_ARRAY_OF_FIELDS],
28 23
            'args'        => ['type' => TypeMap::TYPE_ARRAY_OF_INPUTS],
29 23
            'resolve'     => ['type' => TypeMap::TYPE_FUNCTION],
30 23
            'interfaces'  => ['type' => TypeMap::TYPE_ARRAY_OF_INTERFACES]
31 23
        ];
32
    }
33
34 25
    protected function build()
35
    {
36 25
        $this->buildFields();
37 25
        $this->buildArguments();
38 25
    }
39
40 4
    public function getInterfaces()
41
    {
42 4
        return $this->get('interfaces', []);
43
    }
44
45
}