Completed
Push — master ( 46306f...e069d8 )
by Alexandr
03:27
created

AbstractScalarType   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 2 Features 0
Metric Value
wmc 4
c 4
b 2
f 0
lcom 0
cbo 2
dl 0
loc 28
ccs 9
cts 9
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A parseValue() 0 4 1
A getName() 0 6 1
A getKind() 0 4 1
A isInputType() 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 1:00 AM
7
*/
8
9
namespace Youshido\GraphQL\Type\Scalar;
10
11
use Youshido\GraphQL\Config\Traits\ConfigAwareTrait;
12
use Youshido\GraphQL\Type\AbstractType;
13
use Youshido\GraphQL\Type\TypeMap;
14
15
abstract class AbstractScalarType extends AbstractType
16
{
17
    use ConfigAwareTrait;
18
19 10
    public function getName()
20
    {
21 10
        $className = get_class($this);
22
23 10
        return substr($className, strrpos($className, '\\') + 1, -4);
24
    }
25
26 22
    final public function getKind()
27
    {
28 22
        return TypeMap::KIND_SCALAR;
29
    }
30
31 10
    public function parseValue($value)
32
    {
33 10
        return $this->serialize($value);
34
    }
35
36 2
    public function isInputType()
37
    {
38 2
        return true;
39
    }
40
41
42
}
43