|
1 <?php |
|
2 |
|
3 /** |
|
4 * Zend 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 * It is also available through the world-wide-web at this URL: |
|
11 * http://framework.zend.com/license/new-bsd |
|
12 * If you did not receive a copy of the license and are unable to |
|
13 * obtain it through the world-wide-web, please send an email |
|
14 * to license@zend.com so we can send you a copy immediately. |
|
15 * |
|
16 * @category Zend |
|
17 * @package Zend_Service |
|
18 * @subpackage Delicious |
|
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
20 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
21 * @version $Id: SimplePost.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
22 */ |
|
23 |
|
24 |
|
25 /** |
|
26 * Represents a publicly available post |
|
27 * |
|
28 * @category Zend |
|
29 * @package Zend_Service |
|
30 * @subpackage Delicious |
|
31 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
32 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
33 */ |
|
34 class Zend_Service_Delicious_SimplePost |
|
35 { |
|
36 /** |
|
37 * @var string Post url |
|
38 */ |
|
39 protected $_url; |
|
40 |
|
41 /** |
|
42 * @var string Post title |
|
43 */ |
|
44 protected $_title; |
|
45 |
|
46 /** |
|
47 * @var string Post notes |
|
48 */ |
|
49 protected $_notes; |
|
50 |
|
51 /** |
|
52 * @var array Post tags |
|
53 */ |
|
54 protected $_tags = array(); |
|
55 |
|
56 /** |
|
57 * Constructor |
|
58 * |
|
59 * @param array $post Post data |
|
60 * @return void |
|
61 * @throws Zend_Service_Delicious_Exception |
|
62 */ |
|
63 public function __construct(array $post) |
|
64 { |
|
65 if (!isset($post['u']) || !isset($post['d'])) { |
|
66 /** |
|
67 * @see Zend_Service_Delicious_Exception |
|
68 */ |
|
69 require_once 'Zend/Service/Delicious/Exception.php'; |
|
70 throw new Zend_Service_Delicious_Exception('Title and URL not set.'); |
|
71 } |
|
72 |
|
73 $this->_url = $post['u']; |
|
74 $this->_title = $post['d']; |
|
75 |
|
76 if (isset($post['t'])) { |
|
77 $this->_tags = $post['t']; |
|
78 } |
|
79 if (isset($post['n'])) { |
|
80 $this->_notes = $post['n']; |
|
81 } |
|
82 } |
|
83 |
|
84 /** |
|
85 * Getter for URL |
|
86 * |
|
87 * @return string |
|
88 */ |
|
89 public function getUrl() |
|
90 { |
|
91 return $this->_url; |
|
92 } |
|
93 |
|
94 /** |
|
95 * Getter for title |
|
96 * |
|
97 * @return string |
|
98 */ |
|
99 public function getTitle() |
|
100 { |
|
101 return $this->_title; |
|
102 } |
|
103 |
|
104 /** |
|
105 * Getter for notes |
|
106 * |
|
107 * @return string |
|
108 */ |
|
109 public function getNotes() |
|
110 { |
|
111 return $this->_notes; |
|
112 } |
|
113 |
|
114 /** |
|
115 * Getter for tags |
|
116 * |
|
117 * @return array |
|
118 */ |
|
119 public function getTags() |
|
120 { |
|
121 return $this->_tags; |
|
122 } |
|
123 } |