| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3.0261 |
| Changes | 0 | ||
| 1 | <?php namespace Pz\Doctrine\Rest; |
||
| 27 | 6 | public function alias() |
|
| 28 | { |
||
| 29 | 6 | if ($this->rootAlias === null) { |
|
| 30 | 6 | $reflectionClass = $this->getClassMetadata()->getReflectionClass(); |
|
| 31 | 6 | if ($reflectionClass->implementsInterface(JsonApiResource::class)) { |
|
| 32 | 6 | $this->rootAlias = call_user_func($reflectionClass->getName(). '::getResourceKey'); |
|
| 33 | } else { |
||
| 34 | // Camel case to underscore-case |
||
| 35 | $this->rootAlias = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $reflectionClass->getShortName())); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 39 | 6 | return $this->rootAlias; |
|
| 40 | } |
||
| 57 |