Completed
Push — master ( ce0ced...50615c )
by Alexandr
02:46
created

IdType::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.4286
cc 1
eloc 6
nc 1
nop 0
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
    public function serialize($value)
15
    {
16
        return (string)$value;
17
    }
18
19
    public function isValidValue($value)
20
    {
21
        return !empty($value);
22
    }
23
24
    public function getDescription()
25
    {
26
        return 'The `ID` scalar type represents a unique identifier, often used to ' .
27
               'refetch an object or as key for a cache. The ID type appears in a JSON ' .
28
               'response as a String; however, it is not intended to be human-readable. ' .
29
               'When expected as an input type, any string (such as `"4"`) or integer ' .
30
               '(such as `4`) input value will be accepted as an ID.';
31
    }
32
}