IdType   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 90.91%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A serialize() 0 8 2
A getDescription() 0 8 1
1
<?php
2
/*
3
* This file is a part of GraphQL project.
4
*
5
* @author Alexandr Viniychuk <[email protected]>
6
* created: 12/4/15 12:41 AM
7
*/
8
9
namespace Youshido\GraphQL\Type\Scalar;
10
11
12
class IdType extends AbstractScalarType
13
{
14
15 9
    public function getName()
16
    {
17 9
        return 'ID';
18
    }
19
20 12
    public function serialize($value)
21
    {
22 12
        if (null === $value) {
23
            return null;
24
        }
25
26 12
        return (string)$value;
27
    }
28
29 1
    public function getDescription()
30
    {
31
        return 'The `ID` scalar type represents a unique identifier, often used to ' .
32 1
               'refetch an object or as key for a cache. The ID type appears in a JSON ' .
33 1
               'response as a String; however, it is not intended to be human-readable. ' .
34 1
               'When expected as an input type, any string (such as `"4"`) or integer ' .
35 1
               '(such as `4`) input value will be accepted as an ID.';
36
    }
37
}
38