SimplePost.php 2.6 KB

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