setAuthor() public method

public setAuthor ( string $author )
$author string
コード例 #1
0
ファイル: ItemTest.php プロジェクト: fastfeed/fastfeed
 public function testItem()
 {
     $item = new Item();
     $date = new DateTime();
     $item->setId('id');
     $item->setName('name');
     $item->setIntro('intro');
     $item->setContent('content');
     $item->setSource('source');
     $item->setAuthor('author');
     $item->setImage('image');
     $item->setDate($date);
     $item->setExtra('key', 'value');
     $item->setTags(array('tag'));
     $this->assertEquals('id', $item->getId());
     $this->assertEquals('name', $item->getName());
     $this->assertEquals('intro', $item->getIntro());
     $this->assertEquals('content', $item->getContent());
     $this->assertEquals('source', $item->getSource());
     $this->assertEquals('author', $item->getAuthor());
     $this->assertEquals('image', $item->getImage());
     $this->assertEquals($date, $item->getDate());
     $this->assertEquals('value', $item->getExtra('key'));
     $this->assertEquals(null, $item->getExtra('key-no-exist'));
     $this->assertEquals(array('tag'), $item->getTags());
 }
コード例 #2
0
ファイル: AtomParser.php プロジェクト: fastfeed/fastfeed
 /**
  * @param DOMElement $node
  * @param Item       $item
  */
 protected function setAuthor(DOMElement $node, Item $item)
 {
     $nodeList = $node->getElementsByTagName('author');
     if ($nodeList->length) {
         foreach ($nodeList->item(0)->childNodes as $nodeResult) {
             if ($nodeResult->nodeName != 'email') {
                 continue;
             }
             $item->setAuthor($nodeResult->nodeValue);
             break;
         }
     }
 }