CosmosResult.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 Technorati
  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. * @see Zend_Service_Technorati_Result
  24. */
  25. require_once 'Zend/Service/Technorati/Result.php';
  26. /**
  27. * Represents a single Technorati Cosmos query result object.
  28. * It is never returned as a standalone object,
  29. * but it always belongs to a valid Zend_Service_Technorati_CosmosResultSet object.
  30. *
  31. * @category Zend
  32. * @package Zend_Service
  33. * @subpackage Technorati
  34. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  35. * @license http://framework.zend.com/license/new-bsd New BSD License
  36. */
  37. class Zend_Service_Technorati_CosmosResult extends Zend_Service_Technorati_Result
  38. {
  39. /**
  40. * Technorati weblog object that links queried URL.
  41. *
  42. * @var Zend_Service_Technorati_Weblog
  43. * @access protected
  44. */
  45. protected $_weblog;
  46. /**
  47. * The nearest permalink tracked for queried URL.
  48. *
  49. * @var Zend_Uri_Http
  50. * @access protected
  51. */
  52. protected $_nearestPermalink;
  53. /**
  54. * The excerpt of the blog/page linking queried URL.
  55. *
  56. * @var string
  57. * @access protected
  58. */
  59. protected $_excerpt;
  60. /**
  61. * The the datetime the link was created.
  62. *
  63. * @var Zend_Date
  64. * @access protected
  65. */
  66. protected $_linkCreated;
  67. /**
  68. * The URL of the specific link target page
  69. *
  70. * @var Zend_Uri_Http
  71. * @access protected
  72. */
  73. protected $_linkUrl;
  74. /**
  75. * Constructs a new object object from DOM Element.
  76. *
  77. * @param DomElement $dom the ReST fragment for this object
  78. */
  79. public function __construct(DomElement $dom)
  80. {
  81. $this->_fields = array( '_nearestPermalink' => 'nearestpermalink',
  82. '_excerpt' => 'excerpt',
  83. '_linkCreated' => 'linkcreated',
  84. '_linkUrl' => 'linkurl');
  85. parent::__construct($dom);
  86. // weblog object field
  87. $this->_parseWeblog();
  88. // filter fields
  89. $this->_nearestPermalink = Zend_Service_Technorati_Utils::normalizeUriHttp($this->_nearestPermalink);
  90. $this->_linkUrl = Zend_Service_Technorati_Utils::normalizeUriHttp($this->_linkUrl);
  91. $this->_linkCreated = Zend_Service_Technorati_Utils::normalizeDate($this->_linkCreated);
  92. }
  93. /**
  94. * Returns the weblog object that links queried URL.
  95. *
  96. * @return Zend_Service_Technorati_Weblog
  97. */
  98. public function getWeblog() {
  99. return $this->_weblog;
  100. }
  101. /**
  102. * Returns the nearest permalink tracked for queried URL.
  103. *
  104. * @return Zend_Uri_Http
  105. */
  106. public function getNearestPermalink() {
  107. return $this->_nearestPermalink;
  108. }
  109. /**
  110. * Returns the excerpt of the blog/page linking queried URL.
  111. *
  112. * @return string
  113. */
  114. public function getExcerpt() {
  115. return $this->_excerpt;
  116. }
  117. /**
  118. * Returns the datetime the link was created.
  119. *
  120. * @return Zend_Date
  121. */
  122. public function getLinkCreated() {
  123. return $this->_linkCreated;
  124. }
  125. /**
  126. * If queried URL is a valid blog,
  127. * returns the URL of the specific link target page.
  128. *
  129. * @return Zend_Uri_Http
  130. */
  131. public function getLinkUrl() {
  132. return $this->_linkUrl;
  133. }
  134. }