PageRenderTime 152ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/library/Zend/Service/Simpy/Link.php

https://bitbucket.org/farouqzaib/precurio
PHP | 215 lines | 64 code | 25 blank | 126 comment | 1 complexity | 82a9477b4af98ea18a0d0678840b5eab MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.0, CC-BY-SA-3.0, MIT, LGPL-2.1
  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 Simpy
  18. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id: Link.php 20096 2010-01-06 02:05:09Z bkarwin $
  21. */
  22. /**
  23. * @category Zend
  24. * @package Zend_Service
  25. * @subpackage Simpy
  26. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  27. * @license http://framework.zend.com/license/new-bsd New BSD License
  28. */
  29. class Zend_Service_Simpy_Link
  30. {
  31. /**
  32. * Private access type
  33. *
  34. * @var string
  35. */
  36. const ACCESSTYPE_PRIVATE = '0';
  37. /**
  38. * Public access type
  39. *
  40. * @var string
  41. */
  42. const ACCESSTYPE_PUBLIC = '1';
  43. /**
  44. * Access type assigned to the link
  45. *
  46. * @var string
  47. */
  48. protected $_accessType;
  49. /**
  50. * URL of the link
  51. *
  52. * @var string
  53. */
  54. protected $_url;
  55. /**
  56. * Date of the last modification made to the link
  57. *
  58. * @var string
  59. */
  60. protected $_modDate;
  61. /**
  62. * Date the link was added
  63. *
  64. * @var string
  65. */
  66. protected $_addDate;
  67. /**
  68. * Title assigned to the link
  69. *
  70. * @var string
  71. */
  72. protected $_title;
  73. /**
  74. * Nickname assigned to the link
  75. *
  76. * @var string
  77. */
  78. protected $_nickname;
  79. /**
  80. * Tags assigned to the link
  81. *
  82. * @var array
  83. */
  84. protected $_tags;
  85. /**
  86. * Note assigned to the link
  87. *
  88. * @var string
  89. */
  90. protected $_note;
  91. /**
  92. * Constructor to initialize the object with data
  93. *
  94. * @param DOMNode $node Individual <link> node from a parsed response from
  95. * a GetLinks operation
  96. * @return void
  97. */
  98. public function __construct($node)
  99. {
  100. $this->_accessType = $node->attributes->getNamedItem('accessType')->nodeValue;
  101. $doc = new DOMDocument();
  102. $doc->appendChild($doc->importNode($node, true));
  103. $xpath = new DOMXPath($doc);
  104. $this->_url = $xpath->evaluate('/link/url')->item(0)->nodeValue;
  105. $this->_modDate = $xpath->evaluate('/link/modDate')->item(0)->nodeValue;
  106. $this->_addDate = $xpath->evaluate('/link/addDate')->item(0)->nodeValue;
  107. $this->_title = $xpath->evaluate('/link/title')->item(0)->nodeValue;
  108. $this->_nickname = $xpath->evaluate('/link/nickname')->item(0)->nodeValue;
  109. $this->_note = $xpath->evaluate('/link/note')->item(0)->nodeValue;
  110. $list = $xpath->query('/link/tags/tag');
  111. $this->_tags = array();
  112. for ($x = 0; $x < $list->length; $x++) {
  113. $this->_tags[$x] = $list->item($x)->nodeValue;
  114. }
  115. }
  116. /**
  117. * Returns the access type assigned to the link
  118. *
  119. * @see ACCESSTYPE_PRIVATE
  120. * @see ACCESSTYPE_PUBLIC
  121. * @return string
  122. */
  123. public function getAccessType()
  124. {
  125. return $this->_accessType;
  126. }
  127. /**
  128. * Returns the URL of the link
  129. *
  130. * @return string
  131. */
  132. public function getUrl()
  133. {
  134. return $this->_url;
  135. }
  136. /**
  137. * Returns the date of the last modification made to the link
  138. *
  139. * @return string
  140. */
  141. public function getModDate()
  142. {
  143. return $this->_modDate;
  144. }
  145. /**
  146. * Returns the date the link was added
  147. *
  148. * @return string
  149. */
  150. public function getAddDate()
  151. {
  152. return $this->_addDate;
  153. }
  154. /**
  155. * Returns the title assigned to the link
  156. *
  157. * @return string
  158. */
  159. public function getTitle()
  160. {
  161. return $this->_title;
  162. }
  163. /**
  164. * Returns the nickname assigned to the link
  165. *
  166. * @return string
  167. */
  168. public function getNickname()
  169. {
  170. return $this->_nickname;
  171. }
  172. /**
  173. * Returns the tags assigned to the link
  174. *
  175. * @return array
  176. */
  177. public function getTags()
  178. {
  179. return $this->_tags;
  180. }
  181. /**
  182. * Returns the note assigned to the link
  183. *
  184. * @return string
  185. */
  186. public function getNote()
  187. {
  188. return $this->_note;
  189. }
  190. }