2
0

LinkQuery.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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-2012 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. * @category Zend
  24. * @package Zend_Service
  25. * @subpackage Simpy
  26. * @copyright Copyright (c) 2005-2012 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_LinkQuery
  30. {
  31. /**
  32. * Query string for the query
  33. *
  34. * @var string
  35. */
  36. protected $_query = null;
  37. /**
  38. * Maximum number of search results to return
  39. *
  40. * @var int
  41. */
  42. protected $_limit = null;
  43. /**
  44. * Date on which search results must have been added
  45. *
  46. * @var string
  47. */
  48. protected $_date = null;
  49. /**
  50. * Date after which search results must have been added
  51. *
  52. * @var string
  53. */
  54. protected $_afterDate = null;
  55. /**
  56. * Date before which search results must have been added
  57. *
  58. * @var string
  59. */
  60. protected $_beforeDate = null;
  61. /**
  62. * Sets the query string for the query
  63. *
  64. * @param string $query Query string in valid Simpy syntax
  65. * @see http://www.simpy.com/faq#searchSyntax
  66. * @see http://www.simpy.com/faq#searchFieldsLinks
  67. * @return Zend_Service_Simpy_LinkQuery Provides a fluent interface
  68. */
  69. public function setQueryString($query)
  70. {
  71. $this->_query = $query;
  72. return $this;
  73. }
  74. /**
  75. * Returns the query string set for this query
  76. *
  77. * @return string
  78. */
  79. public function getQueryString()
  80. {
  81. return $this->_query;
  82. }
  83. /**
  84. * Sets the maximum number of search results to return
  85. *
  86. * @param int $limit
  87. * @return Zend_Service_Simpy_LinkQuery Provides a fluent interface
  88. */
  89. public function setLimit($limit)
  90. {
  91. $this->_limit = intval($limit);
  92. if ($this->_limit == 0) {
  93. $this->_limit = null;
  94. }
  95. return $this;
  96. }
  97. /**
  98. * Returns the maximum number of search results to return
  99. *
  100. * @return int
  101. */
  102. public function getLimit()
  103. {
  104. return $this->_limit;
  105. }
  106. /**
  107. * Sets the date on which search results must have been added, which will
  108. * override any existing values set using setAfterDate() and setBeforeDate()
  109. *
  110. * @param string $date
  111. * @see setAfterDate()
  112. * @see setBeforeDate()
  113. * @return Zend_Service_Simpy_LinkQuery Provides a fluent interface
  114. */
  115. public function setDate($date)
  116. {
  117. $this->_date = $date;
  118. $this->_afterDate = null;
  119. $this->_beforeDate = null;
  120. return $this;
  121. }
  122. /**
  123. * Returns the date on which search results must have been added
  124. *
  125. * @return string
  126. */
  127. public function getDate()
  128. {
  129. return $this->_date;
  130. }
  131. /**
  132. * Sets the date after which search results must have been added, which will
  133. * override any existing values set using setDate()
  134. *
  135. * @param string $date
  136. * @see setDate()
  137. * @return Zend_Service_Simpy_LinkQuery Provides a fluent interface
  138. */
  139. public function setAfterDate($date)
  140. {
  141. $this->_afterDate = $date;
  142. $this->_date = null;
  143. return $this;
  144. }
  145. /**
  146. * Returns the date after which search results must have been added
  147. *
  148. * @return string
  149. */
  150. public function getAfterDate()
  151. {
  152. return $this->_afterDate;
  153. }
  154. /**
  155. * Sets the date before which search results must have been added, which
  156. * will override any existing values set using setDate()
  157. *
  158. * @param string $date
  159. * @see setDate()
  160. * @return Zend_Service_Simpy_LinkQuery Provides a fluent interface
  161. */
  162. public function setBeforeDate($date)
  163. {
  164. $this->_beforeDate = $date;
  165. $this->_date = null;
  166. return $this;
  167. }
  168. /**
  169. * Returns the date before which search results must have been added
  170. *
  171. * @return string
  172. */
  173. public function getBeforeDate()
  174. {
  175. return $this->_beforeDate;
  176. }
  177. }