/** * Get an production. * * @param string $id * ID of the production to load. * * @return CultureFeed_Cdb_Item_Event * @throws CultureFeed_ParseException */ public function getProduction($id) { $result = $this->oauth_client->authenticatedGetAsXml('production/' . $id); try { $xml = new CultureFeed_SimpleXMLElement($result); } catch (Exception $e) { throw new CultureFeed_ParseException($result); } if ($xml->production) { $productionXml = $xml->production; return CultureFeed_Cdb_Item_Production::parseFromCdbXml($productionXml); } throw new CultureFeed_ParseException($result); }
/** * Parse a given xml element to an CultureFeed_Cdb_Item_Base. * @param SimpleXMLElement $xmlElement * XML element from the item to parse. */ public static function parseItem(SimpleXMLElement $xmlElement) { // Return the correct cdb item. switch ($xmlElement->getName()) { case 'event': return CultureFeed_Cdb_Item_Event::parseFromCdbXml($xmlElement); case 'production': return CultureFeed_Cdb_Item_Production::parseFromCdbXml($xmlElement); case 'actor': return CultureFeed_Cdb_Item_Actor::parseFromCdbXml($xmlElement); default: return NULL; } }