Esempio n. 1
0
 /**
  * @group ZF-10242
  */
 public function testCount()
 {
     $feed = new App\Feed();
     $feed->addEntry('foo')->addEntry('bar');
     $this->assertEquals(2, $feed->count());
     $this->assertEquals(2, count($feed));
 }
Esempio n. 2
0
 /**
  * Retrieve previous set of results based on a given feed.
  *
  * @param \ZendGData\App\Feed $feed The feed from which to
  *          retreive the previous set of results.
  * @param string $className (optional) The class of feed to be returned.
  *          If null, the previous feed (if found) will be the same class as
  *          the feed that was given as the first argument.
  * @return \ZendGData\App\Feed|null Returns a
  *          ZendGData\App\Feed or null if no previous set of results
  *          exists.
  */
 public function getPreviousFeed($feed, $className = null)
 {
     $previousLink = $feed->getPreviousLink();
     if (!$previousLink) {
         return null;
     }
     $previousLinkHref = $previousLink->getHref();
     if ($className === null) {
         $className = get_class($feed);
     }
     return $this->getFeed($previousLinkHref, $className);
 }
Esempio n. 3
0
 /**
  * Given a DOMNode representing an attribute, tries to map the data into
  * instance members.  If no mapping is defined, the name and value are
  * stored in an array.
  *
  * @param DOMNode $attribute The DOMNode attribute needed to be handled
  */
 protected function takeAttributeFromDOM($attribute)
 {
     switch ($attribute->localName) {
         case 'etag':
             // ETags are special, since they can be conveyed by either the
             // HTTP ETag header or as an XML attribute.
             $etag = $attribute->nodeValue;
             if (!$this->_etag instanceof Etag) {
                 $this->_etag = $etag;
             } elseif ($this->_etag->getFieldValue() != $etag) {
                 throw new App\IOException("ETag mismatch");
             }
             break;
         default:
             parent::takeAttributeFromDOM($attribute);
             break;
     }
 }