/library/Zend/Service/Technorati/SearchResult.php

https://bitbucket.org/hamidrezas/melobit · PHP · 150 lines · 36 code · 18 blank · 96 comment · 0 complexity · 185fa600365e4229c3f1d5285f84715f MD5 · raw file

  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-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id: SearchResult.php 24594 2012-01-05 21:27:01Z matthew $
  21. */
  22. /**
  23. * @see Zend_Service_Technorati_Result
  24. */
  25. require_once 'Zend/Service/Technorati/Result.php';
  26. /**
  27. * Represents a single Technorati Search query result object.
  28. * It is never returned as a standalone object,
  29. * but it always belongs to a valid Zend_Service_Technorati_SearchResultSet object.
  30. *
  31. * @category Zend
  32. * @package Zend_Service
  33. * @subpackage Technorati
  34. * @copyright Copyright (c) 2005-2012 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_SearchResult extends Zend_Service_Technorati_Result
  38. {
  39. /**
  40. * Technorati weblog object corresponding to queried keyword.
  41. *
  42. * @var Zend_Service_Technorati_Weblog
  43. * @access protected
  44. */
  45. protected $_weblog;
  46. /**
  47. * The title of the entry.
  48. *
  49. * @var string
  50. * @access protected
  51. */
  52. protected $_title;
  53. /**
  54. * The blurb from entry with search term highlighted.
  55. *
  56. * @var string
  57. * @access protected
  58. */
  59. protected $_excerpt;
  60. /**
  61. * The datetime the entry was created.
  62. *
  63. * @var Zend_Date
  64. * @access protected
  65. */
  66. protected $_created;
  67. /**
  68. * The permalink of the blog entry.
  69. *
  70. * @var Zend_Uri_Http
  71. * @access protected
  72. */
  73. protected $_permalink;
  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( '_permalink' => 'permalink',
  82. '_excerpt' => 'excerpt',
  83. '_created' => 'created',
  84. '_title' => 'title');
  85. parent::__construct($dom);
  86. // weblog object field
  87. $this->_parseWeblog();
  88. // filter fields
  89. $this->_permalink = Zend_Service_Technorati_Utils::normalizeUriHttp($this->_permalink);
  90. $this->_created = Zend_Service_Technorati_Utils::normalizeDate($this->_created);
  91. }
  92. /**
  93. * Returns the weblog object that links queried URL.
  94. *
  95. * @return Zend_Service_Technorati_Weblog
  96. */
  97. public function getWeblog() {
  98. return $this->_weblog;
  99. }
  100. /**
  101. * Returns the title of the entry.
  102. *
  103. * @return string
  104. */
  105. public function getTitle() {
  106. return $this->_title;
  107. }
  108. /**
  109. * Returns the blurb from entry with search term highlighted.
  110. *
  111. * @return string
  112. */
  113. public function getExcerpt() {
  114. return $this->_excerpt;
  115. }
  116. /**
  117. * Returns the datetime the entry was created.
  118. *
  119. * @return Zend_Date
  120. */
  121. public function getCreated() {
  122. return $this->_created;
  123. }
  124. /**
  125. * Returns the permalink of the blog entry.
  126. *
  127. * @return Zend_Uri_Http
  128. */
  129. public function getPermalink() {
  130. return $this->_permalink;
  131. }
  132. }