File indexing completed on 2025-01-26 05:25:26

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Service
0018  * @subpackage Delicious
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id$
0022  */
0023 
0024 
0025 /**
0026  * Represents a publicly available post
0027  *
0028  * @category   Zend
0029  * @package    Zend_Service
0030  * @subpackage Delicious
0031  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0032  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0033  */
0034 class Zend_Service_Delicious_SimplePost
0035 {
0036     /**
0037      * @var string Post url
0038      */
0039     protected $_url;
0040 
0041     /**
0042      * @var string Post title
0043      */
0044     protected $_title;
0045 
0046     /**
0047      * @var string Post notes
0048      */
0049     protected $_notes;
0050 
0051     /**
0052      * @var array Post tags
0053      */
0054     protected $_tags = array();
0055 
0056     /**
0057      * Constructor
0058      *
0059      * @param   array $post Post data
0060      * @return  void
0061      * @throws  Zend_Service_Delicious_Exception
0062      */
0063     public function __construct(array $post)
0064     {
0065         if (!isset($post['u']) || !isset($post['d'])) {
0066             /**
0067              * @see Zend_Service_Delicious_Exception
0068              */
0069             // require_once 'Zend/Service/Delicious/Exception.php';
0070             throw new Zend_Service_Delicious_Exception('Title and URL not set.');
0071         }
0072 
0073         $this->_url   = $post['u'];
0074         $this->_title = $post['d'];
0075 
0076         if (isset($post['t'])) {
0077             $this->_tags = $post['t'];
0078         }
0079         if (isset($post['n'])) {
0080             $this->_notes = $post['n'];
0081         }
0082     }
0083 
0084     /**
0085      * Getter for URL
0086      *
0087      * @return string
0088      */
0089     public function getUrl()
0090     {
0091         return $this->_url;
0092     }
0093 
0094     /**
0095      * Getter for title
0096      *
0097      * @return string
0098      */
0099     public function getTitle()
0100     {
0101         return $this->_title;
0102     }
0103 
0104     /**
0105      * Getter for notes
0106      *
0107      * @return string
0108      */
0109     public function getNotes()
0110     {
0111         return $this->_notes;
0112     }
0113 
0114     /**
0115      * Getter for tags
0116      *
0117      * @return array
0118      */
0119     public function getTags()
0120     {
0121         return $this->_tags;
0122     }
0123 }