示例#1
0
 public function testLink()
 {
     $authorNoLink = new Author('J.R.R. Tolkien');
     $this->assertFalse($authorNoLink->hasLink());
     $link = new Url('https://en.wikipedia.org/wiki/George_Orwell');
     $authorLink = new Author('George Orwell', $link);
     $this->assertTrue($authorLink->hasLink());
     $this->assertEquals($link, $authorLink->getLink());
 }
示例#2
0
 /**
  * The author parameters will display a small section at the top of a message attachment.
  *
  * @param Author $author
  *
  * @return self
  */
 public function setAuthor(Author $author)
 {
     $this->attachment['author_name'] = $author;
     if ($author->hasIcon()) {
         $this->attachment['author_icon'] = $author->getIcon();
     }
     if ($author->hasLink()) {
         $this->attachment['author_link'] = $author->getLink();
     }
     return $this;
 }