Conditions | 9 |
Paths | 9 |
Total Lines | 29 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public function resolveType($name) |
||
19 | { |
||
20 | if (preg_match('#^(.+)\!$#', $name, $regs)) { |
||
21 | return Type::nonNull($this->resolveType($regs[1])); |
||
22 | } |
||
23 | |||
24 | if (preg_match('#^\[(.+)\]$#', $name, $regs)) { |
||
25 | return Type::listOf($this->resolveType($regs[1])); |
||
26 | } |
||
27 | |||
28 | switch ($name) { |
||
29 | case Type::INT: |
||
30 | return Type::int(); |
||
31 | case Type::STRING: |
||
32 | return Type::string(); |
||
33 | case Type::BOOLEAN: |
||
34 | return Type::boolean(); |
||
35 | case Type::FLOAT: |
||
36 | return Type::float(); |
||
37 | case Type::ID: |
||
38 | return Type::id(); |
||
39 | default: |
||
40 | if (!isset($this->types[$name])) { |
||
41 | throw new \InvalidArgumentException(sprintf('Type "%s" is not defined', $name)); |
||
42 | } |
||
43 | |||
44 | return $this->types[$name]; |
||
45 | } |
||
46 | } |
||
47 | |||
75 |