Esempio n. 1
0
 /**
  * Generic way of requesting Plex library items.
  *
  * @uses Plex_MachineAbstract::$name
  * @uses Plex_MachineAbstract::$address
  * @uses Plex_MachineAbstract::$port
  * @uses Plex_MachineAbstract::makeCall()
  * @uses Plex_Server_Library::buildUrl()
  * @uses Plex_Server_Library_ItemAbstract::factory()
  * @uses Plex_Server_Library_ItemInterface::setAttributes()
  *
  * return Plex_Server_Library_Item[] An array of plex library items.
  */
 protected function getItems($endpoint)
 {
     $items = array();
     $itemArray = $this->makeCall($this->buildUrl($endpoint));
     foreach ($itemArray as $attribute) {
         // Not all attributes at this point have a 'type.' Sometimes they
         // represent a different sort of list like 'All episodes.' In this
         // case we skip it by checking the integrity of the 'type' index.
         // If there is no type index then it is not an item.
         if (isset($attribute['type'])) {
             $item = Plex_Server_Library_ItemAbstract::factory($attribute['type'], $this->name, $this->address, $this->port);
             $item->setAttributes($attribute);
             $items[] = $item;
         }
     }
     return $items;
 }