| Total Complexity | 7 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | abstract class Base extends CComponent implements ITypeaheadData |
||
| 11 | { |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var string |
||
| 15 | */ |
||
| 16 | public $label; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | public $thumbnail; |
||
| 22 | |||
| 23 | public function getName() |
||
| 24 | { |
||
| 25 | return $this->label; |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Returns the name of the first field that ends with "id". This is needed |
||
| 30 | * because all items from the XBMC API use different identifiers. |
||
| 31 | * @return string the name of the "id" field |
||
| 32 | */ |
||
| 33 | public function getIdField() |
||
| 34 | { |
||
| 35 | foreach (array_keys(get_object_vars($this)) as $property) |
||
| 36 | if (substr($property, -2) === 'id') |
||
| 37 | return $property; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @return string ID of this item |
||
| 42 | */ |
||
| 43 | public function getId() |
||
| 44 | { |
||
| 45 | return $this->{$this->getIdField()}; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @return string the display name of this item |
||
| 50 | */ |
||
| 51 | public function getDisplayName() |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @return string the artwork for this item |
||
| 58 | */ |
||
| 59 | public function getArtwork() |
||
| 62 | } |
||
| 63 | |||
| 65 |