/** * @param string $cdbId * @return \CultureFeed_Cdb_Item_Actor|false * @throws \CultureFeed_Cdb_ParseException */ public function getActor($cdbId) { $request = $this->getCnetRequest(); $request->getQuery()->set('q', 'cdbid:' . $cdbId); $request->getQuery()->set('group', 'actor'); try { $response = $request->send(); $responseBody = $response->getBody(true); $xml = simplexml_load_string($responseBody, 'SimpleXMLElement', 0, $this->config->getNameSpace()); $actors = array(); foreach ($xml->actor as $actorXml) { if ($actor = \CultureFeed_Cdb_Item_Actor::parseFromCdbXml($actorXml)) { $actors[] = $actor; } } if (count($actors) != 1) { $this->logger->warning(t('More than one or no Actor found for @cdbid, count: @count', array('@cdbid' => $cdbId, '@count' => count($actors)))); return false; } return $actors[0]; } catch (ClientErrorResponseException $e) { throw $e; } }