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