/**
  * @param array $profiles
  */
 public function setProfileSummaries($profiles)
 {
     foreach ($profiles as $profile) {
         if (is_array($profile)) {
             $profile = APIResponseObjectFactory::create($profile);
         }
         $this->_profileSummariesByName[$profile->getName()] = $this->_profileSummariesByID[$profile->getID()] = $profile;
     }
 }
 /**
  * @param array $webProperties
  */
 public function setWebPropertySummaries(array $webProperties)
 {
     foreach ($webProperties as $webProperty) {
         if (is_array($webProperty)) {
             $webProperty = APIResponseObjectFactory::create($webProperty);
         }
         $this->_webPropertySummariesByName[$webProperty->getName()] = $this->_webPropertySummariesByID[$webProperty->getID()] = $webProperty;
     }
 }
Exemplo n.º 3
0
 /**
  * Returns an object or an array of objects from the parsed response.
  *
  * @return array, Google\Analytics\AbstractAPIResponseObject
  */
 protected function _castResponse()
 {
     if (array_key_exists('nextLink', $this->_responseParsed)) {
         try {
             $this->_nextRequest = clone $this->_request;
             $this->_nextRequest->setURL(new \URL($this->_responseParsed['nextLink']));
         } catch (\URLException $e) {
             throw new UnexpectedValueException('Caught error while parsing paginated URL.', null, $e);
         }
     } else {
         $this->_nextRequest = null;
     }
     if (array_key_exists('items', $this->_responseParsed)) {
         $items = array();
         foreach ($this->_responseParsed['items'] as $item) {
             $items[] = APIResponseObjectFactory::create($item);
         }
         return $items;
     }
     return APIResponseObjectFactory::create($this->_responseParsed);
 }