| Conditions | 6 |
| Paths | 11 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function canHandleType($type) |
||
| 26 | { |
||
| 27 | $type = trim($type, '\\'); |
||
| 28 | if (!\class_exists($type)) { |
||
| 29 | return false; |
||
| 30 | } |
||
| 31 | $abstractEntity = trim(AbstractEntity::class, '\\'); |
||
| 32 | try { |
||
| 33 | if ($type === $abstractEntity) { |
||
| 34 | return true; |
||
| 35 | } |
||
| 36 | $reflection = new \ReflectionClass($type); |
||
| 37 | while ($reflection = $reflection->getParentClass()) { |
||
| 38 | if ($abstractEntity === trim($reflection->getName(), '\\')) { |
||
| 39 | return true; |
||
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | return false; |
||
| 44 | } catch (\Exception $exception) { |
||
| 45 | return false; |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 81 |