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\Abstracts;
14:
15: /**
16: * Classe abstraite de flux.
17: * @category Pry
18: * @package Feed
19: * @subpackage Feed_Abstract
20: * @version 1.1.0
21: * @abstract
22: * @author Olivier ROGER <oroger.fr>
23: *
24: */
25: abstract class Feed
26: {
27:
28: /**
29: * Titre du flux
30: * @access protected
31: * @var string
32: */
33: protected $title;
34:
35: /**
36: * Date du flux
37: * @access protected
38: * @var string
39: */
40: protected $date;
41:
42: /**
43: * Auteur du flux
44: * @access protected
45: * @var array
46: */
47: protected $author;
48:
49: /**
50: * Langue du flux
51: * @access protected
52: * @var string
53: */
54: protected $lang;
55:
56: /**
57: * Description du flux
58: * @access protected
59: * @var string
60: */
61: protected $description;
62:
63: /**
64: * Copyright du flux
65: * @access protected
66: * @var string
67: */
68: protected $copyright;
69:
70: /**
71: * Lien vers le flux
72: * @access protected
73: * @var string
74: */
75: protected $link;
76:
77: /**
78: * Id du flux
79: * @access protected
80: * @var string
81: */
82: protected $id;
83:
84: public function setTitle($title)
85: {
86: if (empty($title) || !is_string($title))
87: throw new \InvalidArgumentException('Titre de flux invalide');
88: $this->title = $title;
89: return $this;
90: }
91:
92: public function setDate($date)
93: {
94: $this->date = $date;
95: return $this;
96: }
97:
98: public function setAuthor(array $author)
99: {
100: if (!is_array($author) || !key_exists('name', $author))
101: throw new \InvalidArgumentException('Author doit être un Array avec la clé name');
102:
103: $this->author = $author;
104: return $this;
105: }
106:
107: public function setLang($lang)
108: {
109: if (empty($lang) || !is_string($lang))
110: throw new \InvalidArgumentException('Langue de flux invalide');
111:
112: $this->lang = $lang;
113: return $this;
114: }
115:
116: public function setDescription($desc)
117: {
118: if (empty($desc) || !is_string($desc))
119: throw new \InvalidArgumentException('Description de flux invalide');
120:
121: $this->description = $desc;
122: return $this;
123: }
124:
125: public function setCopyright($cr)
126: {
127: if (empty($cr) || !is_string($cr))
128: throw new \InvalidArgumentException('Copyright de flux invalide');
129:
130: $this->copyright = $cr;
131: return $this;
132: }
133:
134: public function setLink($link)
135: {
136: if (empty($link) || !is_string($link))
137: throw new \InvalidArgumentException('Lien de flux invalide');
138:
139: $this->link = $link;
140: return $this;
141: }
142:
143: public function setId($id)
144: {
145: if (empty($id) || !is_string($id))
146: throw new \InvalidArgumentException('Id de flux invalide');
147:
148: $this->id = $id;
149: return $this;
150: }
151:
152: public function getTitle()
153: {
154: if (isset($this->title))
155: return $this->title;
156: return null;
157: }
158:
159: public function getDate()
160: {
161: if (isset($this->date))
162: return $this->date;
163: return null;
164: }
165:
166: public function getAuthor($key = null)
167: {
168: if (isset($this->author))
169: if (!empty($key))
170: return $this->author[$key];
171: else
172: return $this->author;
173: return null;
174: }
175:
176: public function getLang()
177: {
178: if (isset($this->lang))
179: return $this->lang;
180: return null;
181: }
182:
183: public function getDescription()
184: {
185: if (isset($this->description))
186: return $this->description;
187: return null;
188: }
189:
190: public function getCopyright()
191: {
192: if (isset($this->copyright))
193: return $this->copyright;
194: return null;
195: }
196:
197: public function getLink()
198: {
199: if (isset($this->link))
200: return $this->link;
201: return null;
202: }
203:
204: public function getId()
205: {
206: if (isset($this->id))
207: return $this->id;
208: return null;
209: }
210:
211: }
212:
213: ?>