TypeParser::getFinalType()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace Arthem\GraphQLMapper\Utils;
4
5
abstract class TypeParser
6
{
7
    /**
8
     * Return the real type if wrapped in a collection
9
     * "[MyCustomType]!" will return "MyCustomType"
10
     *
11
     * @param string $type
12
     * @return string
13
     */
14
    public static function getFinalType($type)
15
    {
16
        if (preg_match('#^\[(.+)\]!?$#', $type, $regs)) {
17
            return $regs[1];
18
        }
19
20
        return $type;
21
    }
22
}
23