| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 3 |
| Changes | 3 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 16 | 1 | public function getEntityLabel($entity) |
|
| 17 | { |
||
| 18 | 1 | $label = ''; |
|
| 19 | 1 | $accessor = PropertyAccess::createPropertyAccessor(); |
|
| 20 | $properties = [ |
||
| 21 | 1 | 'label', |
|
| 22 | 1 | 'title', |
|
| 23 | 1 | 'name', |
|
| 24 | 1 | '__toString', |
|
| 25 | 1 | 'content', |
|
| 26 | 1 | 'id', |
|
| 27 | 1 | ]; |
|
| 28 | |||
| 29 | 1 | foreach ($properties as $property) { |
|
| 30 | |||
| 31 | 1 | if ($accessor->isReadable($entity, $property)) { |
|
| 32 | 1 | $label = $accessor->getValue($entity, $property); |
|
| 33 | 1 | break; |
|
| 34 | } |
||
| 35 | 1 | } |
|
| 36 | |||
| 37 | 1 | return $label; |
|
| 38 | } |
||
| 39 | } |
||
| 40 |