Passed
Push — master ( e52344...df819b )
by Rafael
09:21
created

Types::get()   C

Complexity

Conditions 8
Paths 17

Size

Total Lines 26
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 8.0291

Importance

Changes 0
Metric Value
cc 8
eloc 12
nc 17
nop 1
dl 0
loc 26
ccs 12
cts 13
cp 0.9231
crap 8.0291
rs 5.3846
c 0
b 0
f 0
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Type;
12
13
use GraphQL\Type\Definition\Type as GraphQLType;
14
15
/**
16
 * Type
17
 */
18
final class Types
19
{
20
    public const ID = GraphQLType ::ID;
21
    public const STRING = GraphQLType::STRING;
22
    public const INT = GraphQLType::INT;
23
    public const BOOLEAN = GraphQLType::BOOLEAN;
24
    public const FLOAT = GraphQLType::FLOAT;
25
    public const DATETIME = DateTimeType::DATETIME;
26
27
    /**
28
     * @param string $type
29
     *
30
     * @return string
31
     */
32 3
    public static function listOf(string $type): string
33
    {
34 3
        return sprintf('[%s]', $type);
35
    }
36
37
    /**
38
     * @param string $type
39
     *
40
     * @return string
41
     */
42 1
    public static function nonNull(string $type): string
43
    {
44 1
        return sprintf('%s!', $type);
45
    }
46
}
47