| Conditions | 7 |
| Paths | 7 |
| Total Lines | 20 |
| Code Lines | 16 |
| Lines | 20 |
| Ratio | 100 % |
| Tests | 15 |
| CRAP Score | 7.0119 |
| Changes | 2 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 16 | 1 | View Code Duplication | public function getEntityLabel($entity) |
| 17 | { |
||
| 18 | 1 | $label = ''; |
|
| 19 | 1 | $accessor = PropertyAccess::createPropertyAccessor(); |
|
| 20 | |||
| 21 | 1 | if ($accessor->isReadable($entity, 'label')) { |
|
| 22 | 1 | $label = $accessor->getValue($entity, 'label'); |
|
| 23 | 1 | } else if ($accessor->isReadable($entity, 'title')) { |
|
| 24 | 1 | $label = $accessor->getValue($entity, 'title'); |
|
| 25 | 1 | } else if ($accessor->isReadable($entity, 'name')) { |
|
| 26 | $label = $accessor->getValue($entity, 'name'); |
||
| 27 | 1 | } else if ($accessor->isReadable($entity, '__toString')) { |
|
| 28 | 1 | $label = $accessor->getValue($entity, '__toString'); |
|
| 29 | 1 | } else if ($accessor->isReadable($entity, 'content')) { |
|
| 30 | 1 | $label = strip_tags(substr($label = $accessor->getValue($entity, 'content'), 0, 100)); |
|
| 31 | 1 | } else if ($accessor->isReadable($entity, 'id')) { |
|
| 32 | 1 | $label = $accessor->getValue($entity, 'id'); |
|
| 33 | } |
||
| 34 | 1 | return $label; |
|
| 35 | } |
||
| 36 | } |
||
| 37 |