| Conditions | 4 |
| Paths | 6 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function getOutputTypeName(string $typeClassName, Type $type): string |
||
| 24 | { |
||
| 25 | if ($prevPos = strrpos($typeClassName, '\\')) { |
||
| 26 | $typeClassName = substr($typeClassName, $prevPos + 1); |
||
| 27 | } |
||
| 28 | // By default, if the class name ends with Type, let's take the name of the class for the type |
||
| 29 | if (substr($typeClassName, -4) === 'Type') { |
||
| 30 | return substr($typeClassName, 0, -4); |
||
| 31 | } |
||
| 32 | // Else, let's take the name of the targeted class |
||
| 33 | $typeClassName = $type->getClass(); |
||
| 34 | if ($prevPos = strrpos($typeClassName, '\\')) { |
||
| 35 | $typeClassName = substr($typeClassName, $prevPos + 1); |
||
| 36 | } |
||
| 37 | return $typeClassName; |
||
| 38 | } |
||
| 40 |