1: <?php
2:
3: /**
4: * Pry Framework
5: *
6: * LICENSE
7: *
8: * This source file is subject to the new BSD license that is bundled
9: * with this package in the file LICENSE.txt.
10: *
11: */
12:
13: namespace Pry\Feed;
14:
15: /**
16: * Classe représentant un élément de flux.
17: * @category Pry
18: * @package Feed
19: * @version 1.1.0
20: * @author Olivier ROGER <oroger.fr>
21: *
22: */
23: class Entry
24: {
25:
26: /**
27: * Id de l'élément
28: * @access private
29: * @var string
30: */
31: private $id;
32:
33: /**
34: * Titre de l'élément
35: * @access private
36: * @var string
37: */
38: private $title;
39:
40: /**
41: * Date de l'élément
42: * @access private
43: * @var string
44: */
45: private $date;
46:
47: /**
48: * Auteur de l'élément
49: * @access private
50: * @var array
51: */
52: private $author;
53:
54: /**
55: * Contenu de l'élément
56: * @access private
57: * @var string
58: */
59: private $content;
60:
61: /**
62: * Lien de l'élément
63: * @access private
64: * @var string
65: */
66: private $link;
67:
68: /**
69: * Liens vers les commentaires
70: * @access private
71: * @var string
72: */
73: private $comments;
74:
75: public function __construct()
76: {
77: $this->author = array();
78: }
79:
80: public function setTitle($title)
81: {
82: $this->title = $title;
83: return $this;
84: }
85:
86: public function setDate($date)
87: {
88: $this->date = $date;
89: return $this;
90: }
91:
92: public function setAuthor(array $author)
93: {
94: if (!is_array($author) || !key_exists('name', $author))
95: throw new \InvalidArgumentException('Author doit être un Array');
96: $this->author = $author;
97: return $this;
98: }
99:
100: public function setContent($content)
101: {
102: $this->content = $content;
103: return $this;
104: }
105:
106: public function setLink($link)
107: {
108: $this->link = $link;
109: return $this;
110: }
111:
112: public function setId($id)
113: {
114: $this->id = $id;
115: }
116:
117: public function setComments($com)
118: {
119: $this->comments = $com;
120: }
121:
122: //Getter
123:
124: public function getTitle()
125: {
126: if (isset($this->title))
127: return $this->title;
128: return null;
129: }
130:
131: public function getDate()
132: {
133: if (isset($this->date))
134: return $this->date;
135: return null;
136: }
137:
138: public function getAuthor($key = null)
139: {
140: if (isset($this->author))
141: if (!empty($key) && isset($this->author[$key]))
142: return $this->author[$key];
143: else
144: return $this->author;
145: return null;
146: }
147:
148: public function getContent()
149: {
150: if (isset($this->content))
151: return $this->content;
152: return null;
153: }
154:
155: public function getLink()
156: {
157: if (isset($this->link))
158: return $this->link;
159: return null;
160: }
161:
162: public function getId()
163: {
164: if (isset($this->id))
165: return $this->id;
166: return null;
167: }
168:
169: public function getComments()
170: {
171: if (isset($this->comments))
172: return $this->comments;
173: return null;
174: }
175:
176: }
177:
178: ?>