web/lib/Zend/Service/Simpy/LinkQuery.php
changeset 886 1e110b03ae96
parent 885 2251fb41dbc7
parent 869 82982f1ba738
child 887 503f9a7b7d6c
equal deleted inserted replaced
885:2251fb41dbc7 886:1e110b03ae96
     1 <?php
       
     2 
       
     3 /**
       
     4  * Zend Framework
       
     5  *
       
     6  * LICENSE
       
     7  *
       
     8  * This source file is subject to the new BSD license that is bundled
       
     9  * with this package in the file LICENSE.txt.
       
    10  * It is also available through the world-wide-web at this URL:
       
    11  * http://framework.zend.com/license/new-bsd
       
    12  * If you did not receive a copy of the license and are unable to
       
    13  * obtain it through the world-wide-web, please send an email
       
    14  * to license@zend.com so we can send you a copy immediately.
       
    15  *
       
    16  * @category   Zend
       
    17  * @package    Zend_Service
       
    18  * @subpackage Simpy
       
    19  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    21  * @version    $Id: LinkQuery.php 20096 2010-01-06 02:05:09Z bkarwin $
       
    22  */
       
    23 
       
    24 
       
    25 /**
       
    26  * @category   Zend
       
    27  * @package    Zend_Service
       
    28  * @subpackage Simpy
       
    29  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    30  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    31  */
       
    32 class Zend_Service_Simpy_LinkQuery
       
    33 {
       
    34     /**
       
    35      * Query string for the query
       
    36      *
       
    37      * @var string
       
    38      */
       
    39     protected $_query = null;
       
    40 
       
    41     /**
       
    42      * Maximum number of search results to return
       
    43      *
       
    44      * @var int
       
    45      */
       
    46     protected $_limit = null;
       
    47 
       
    48     /**
       
    49      * Date on which search results must have been added
       
    50      *
       
    51      * @var string
       
    52      */
       
    53     protected $_date = null;
       
    54 
       
    55     /**
       
    56      * Date after which search results must have been added
       
    57      *
       
    58      * @var string
       
    59      */
       
    60     protected $_afterDate = null;
       
    61 
       
    62     /**
       
    63      * Date before which search results must have been added
       
    64      *
       
    65      * @var string
       
    66      */
       
    67     protected $_beforeDate = null;
       
    68 
       
    69     /**
       
    70      * Sets the query string for the query
       
    71      *
       
    72      * @param  string $query Query string in valid Simpy syntax
       
    73      * @see    http://www.simpy.com/faq#searchSyntax
       
    74      * @see    http://www.simpy.com/faq#searchFieldsLinks
       
    75      * @return Zend_Service_Simpy_LinkQuery Provides a fluent interface
       
    76      */
       
    77     public function setQueryString($query)
       
    78     {
       
    79         $this->_query = $query;
       
    80 
       
    81         return $this;
       
    82     }
       
    83 
       
    84     /**
       
    85      * Returns the query string set for this query
       
    86      *
       
    87      * @return string
       
    88      */
       
    89     public function getQueryString()
       
    90     {
       
    91         return $this->_query;
       
    92     }
       
    93 
       
    94     /**
       
    95      * Sets the maximum number of search results to return
       
    96      *
       
    97      * @param  int $limit
       
    98      * @return Zend_Service_Simpy_LinkQuery Provides a fluent interface
       
    99      */
       
   100     public function setLimit($limit)
       
   101     {
       
   102         $this->_limit = intval($limit);
       
   103 
       
   104         if ($this->_limit == 0) {
       
   105             $this->_limit = null;
       
   106         }
       
   107 
       
   108         return $this;
       
   109     }
       
   110 
       
   111     /**
       
   112      * Returns the maximum number of search results to return
       
   113      *
       
   114      * @return int
       
   115      */
       
   116     public function getLimit()
       
   117     {
       
   118         return $this->_limit;
       
   119     }
       
   120 
       
   121     /**
       
   122      * Sets the date on which search results must have been added, which will
       
   123      * override any existing values set using setAfterDate() and setBeforeDate()
       
   124      *
       
   125      * @param  string $date
       
   126      * @see    setAfterDate()
       
   127      * @see    setBeforeDate()
       
   128      * @return Zend_Service_Simpy_LinkQuery Provides a fluent interface
       
   129      */
       
   130     public function setDate($date)
       
   131     {
       
   132         $this->_date = $date;
       
   133         $this->_afterDate = null;
       
   134         $this->_beforeDate = null;
       
   135 
       
   136         return $this;
       
   137     }
       
   138 
       
   139     /**
       
   140      * Returns the date on which search results must have been added
       
   141      *
       
   142      * @return string
       
   143      */
       
   144     public function getDate()
       
   145     {
       
   146         return $this->_date;
       
   147     }
       
   148 
       
   149     /**
       
   150      * Sets the date after which search results must have been added, which will
       
   151      * override any existing values set using setDate()
       
   152      *
       
   153      * @param  string $date
       
   154      * @see    setDate()
       
   155      * @return Zend_Service_Simpy_LinkQuery Provides a fluent interface
       
   156      */
       
   157     public function setAfterDate($date)
       
   158     {
       
   159         $this->_afterDate = $date;
       
   160         $this->_date = null;
       
   161 
       
   162         return $this;
       
   163     }
       
   164 
       
   165     /**
       
   166      * Returns the date after which search results must have been added
       
   167      *
       
   168      * @return string
       
   169      */
       
   170     public function getAfterDate()
       
   171     {
       
   172         return $this->_afterDate;
       
   173     }
       
   174 
       
   175     /**
       
   176      * Sets the date before which search results must have been added, which
       
   177      * will override any existing values set using setDate()
       
   178      *
       
   179      * @param  string $date
       
   180      * @see    setDate()
       
   181      * @return Zend_Service_Simpy_LinkQuery Provides a fluent interface
       
   182      */
       
   183     public function setBeforeDate($date)
       
   184     {
       
   185         $this->_beforeDate = $date;
       
   186         $this->_date = null;
       
   187 
       
   188         return $this;
       
   189     }
       
   190 
       
   191     /**
       
   192      * Returns the date before which search results must have been added
       
   193      *
       
   194      * @return string
       
   195      */
       
   196     public function getBeforeDate()
       
   197     {
       
   198         return $this->_beforeDate;
       
   199     }
       
   200 }