Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
22 / 22 |
CRAP | |
100.00% |
40 / 40 |
| Item | |
100.00% |
1 / 1 |
|
100.00% |
22 / 22 |
26 | |
100.00% |
40 / 40 |
| setId($itemId) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getId() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| getContent() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| setName($name) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| setIntro($intro) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getIntro() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| setContent($content) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getName() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| hasImage() | |
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
|||
| setImage($image) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getImage() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| addTag($tag) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| setTags(array $tags) | |
100.00% |
1 / 1 |
2 | |
100.00% |
5 / 5 |
|||
| getTags() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| setSource($source) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getSource() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| setAuthor($author) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getAuthor() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| setDate(DateTime $date) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getDate() | |
100.00% |
1 / 1 |
2 | |
100.00% |
3 / 3 |
|||
| setExtra($key, $value) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getExtra($key) | |
100.00% |
1 / 1 |
2 | |
100.00% |
3 / 3 |
|||
| <?php | |
| /** | |
| * This file is part of the FastFeed package. | |
| * | |
| * (c) Daniel González <daniel@desarrolla2.com> | |
| * | |
| * For the full copyright and license information, please view the LICENSE | |
| * file that was distributed with this source code. | |
| */ | |
| namespace FastFeed; | |
| use DateTime; | |
| /** | |
| * Node | |
| */ | |
| class Item | |
| { | |
| /** | |
| * @var string | |
| */ | |
| protected $itemId; | |
| /** | |
| * @var string | |
| */ | |
| protected $name; | |
| /** | |
| * @var string | |
| */ | |
| protected $intro; | |
| /** | |
| * @var string | |
| */ | |
| protected $content; | |
| /** | |
| * @var string | |
| */ | |
| protected $source; | |
| /** | |
| * @var string | |
| */ | |
| protected $author; | |
| /** | |
| * @var string | |
| */ | |
| protected $image; | |
| /** | |
| * @var DateTime | |
| */ | |
| protected $date; | |
| /** | |
| * @var array | |
| */ | |
| protected $extra = array(); | |
| /** | |
| * @var array | |
| */ | |
| protected $tags = array(); | |
| /** | |
| * @param string $itemId | |
| */ | |
| public function setId($itemId) | |
| { | |
| $this->itemId = (string) $itemId; | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getId() | |
| { | |
| return $this->itemId; | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getContent() | |
| { | |
| return $this->content; | |
| } | |
| /** | |
| * @param string $name | |
| */ | |
| public function setName($name) | |
| { | |
| $this->name = (string) $name; | |
| } | |
| /** | |
| * @param string $intro | |
| */ | |
| public function setIntro($intro) | |
| { | |
| $this->intro = (string) $intro; | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getIntro() | |
| { | |
| return $this->intro; | |
| } | |
| /** | |
| * @param string $content | |
| */ | |
| public function setContent($content) | |
| { | |
| $this->content = (string) $content; | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getName() | |
| { | |
| return $this->name; | |
| } | |
| /** | |
| * @return bool | |
| */ | |
| public function hasImage() | |
| { | |
| return strlen($this->image) ? true : false; | |
| } | |
| /** | |
| * @param string $image | |
| */ | |
| public function setImage($image) | |
| { | |
| $this->image = (string) $image; | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getImage() | |
| { | |
| return $this->image; | |
| } | |
| /** | |
| * @param string $tag | |
| */ | |
| public function addTag($tag) | |
| { | |
| $this->tags[] = (string) $tag; | |
| } | |
| /** | |
| * @param array $tags | |
| */ | |
| public function setTags(array $tags) | |
| { | |
| $this->tags = array(); | |
| foreach ($tags as $tag) { | |
| $this->addTag($tag); | |
| } | |
| } | |
| /** | |
| * @return array | |
| */ | |
| public function getTags() | |
| { | |
| return $this->tags; | |
| } | |
| /** | |
| * @param string $source | |
| */ | |
| public function setSource($source) | |
| { | |
| $this->source = (string) $source; | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getSource() | |
| { | |
| return $this->source; | |
| } | |
| /** | |
| * @param string $author | |
| */ | |
| public function setAuthor($author) | |
| { | |
| $this->author = (string) $author; | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getAuthor() | |
| { | |
| return $this->author; | |
| } | |
| /** | |
| * @param DateTime $date | |
| */ | |
| public function setDate(DateTime $date) | |
| { | |
| $this->date = $date; | |
| } | |
| /** | |
| * @return DateTime | |
| */ | |
| public function getDate() | |
| { | |
| if (!$this->date) { | |
| return false; | |
| } | |
| return $this->date; | |
| } | |
| /** | |
| * @param $key | |
| * @param $value | |
| */ | |
| public function setExtra($key, $value) | |
| { | |
| $this->extra[$key] = (string) $value; | |
| } | |
| /** | |
| * @param $key | |
| * | |
| * @return bool | |
| */ | |
| public function getExtra($key) | |
| { | |
| if (!isset($this->extra[$key])) { | |
| return; | |
| } | |
| return $this->extra[$key]; | |
| } | |
| } |