AbstractType   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 90.91%

Importance

Changes 0
Metric Value
wmc 11
lcom 1
cbo 0
dl 0
loc 69
ccs 20
cts 22
cp 0.9091
rs 10
c 0
b 0
f 0

11 Methods

Rating   Name   Duplication   Size   Complexity  
A isCompositeType() 0 4 1
A getType() 0 4 1
A getNamedType() 0 4 1
A getNullableType() 0 4 1
A getValidationError() 0 4 1
A isValidValue() 0 4 1
A parseValue() 0 4 1
A parseInputValue() 0 4 1
A serialize() 0 4 1
A isInputType() 0 4 1
A __toString() 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:05 AM
7
*/
8
9
namespace Youshido\GraphQL\Type;
10
11
12
use Youshido\GraphQL\Type\Object\AbstractObjectType;
13
14
abstract class AbstractType implements TypeInterface
15
{
16
17
    protected $lastValidationError = null;
18
19 15
    public function isCompositeType()
20
    {
21 15
        return false;
22
    }
23
24
    /**
25
     * @return AbstractType
26
     */
27 24
    public function getType()
28
    {
29 24
        return $this;
30
    }
31
32
    /**
33
     * @return AbstractType
34
     */
35 21
    public function getNamedType()
36
    {
37 21
        return $this->getType();
38
    }
39
40
    /**
41
     * @return AbstractType|AbstractObjectType
42
     */
43 72
    public function getNullableType()
44
    {
45 72
        return $this;
46
    }
47
48 5
    public function getValidationError($value = null)
49
    {
50 5
        return $this->lastValidationError;
51
    }
52
53 12
    public function isValidValue($value)
54
    {
55 12
        return true;
56
    }
57
58 1
    public function parseValue($value)
59
    {
60 1
        return $value;
61
    }
62
63
    public function parseInputValue($value)
64
    {
65
        return $this->parseValue($value);
66
    }
67
68 1
    public function serialize($value)
69
    {
70 1
        return $value;
71
    }
72
73 21
    public function isInputType()
74
    {
75 21
        return false;
76
    }
77
78 2
    public function __toString()
79
    {
80 2
        return $this->getName();
81
    }
82
}
83