Completed
Push — master ( 6fe909...aff65e )
by Adrien
01:54
created

Utils   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 24
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTypeName() 0 6 1
A getIDTypeName() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQL\Doctrine;
6
7
/**
8
 * A few utils
9
 */
10
abstract class Utils
11
{
12
    /**
13
     * Get the GraphQL type name from the PHP class
14
     * @param string $className
15
     * @return string
16
     */
17 12
    public static function getTypeName(string $className): string
18
    {
19 12
        $parts = explode('\\', $className);
20
21 12
        return end($parts);
22
    }
23
24
    /**
25
     * Get the GraphQL type name for an ID type from the PHP class
26
     * @param string $className
27
     * @return string
28
     */
29 4
    public static function getIDTypeName(string $className): string
30
    {
31 4
        return self::getTypeName($className) . 'ID';
32
    }
33
}
34