Services_Yahoo
[ class tree: Services_Yahoo ] [ index: Services_Yahoo ] [ all elements ]

Source for file local.php

Documentation is available at local.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  3.  
  4. /**
  5.  * Local search class
  6.  *
  7.  * Copyright 2005-2006 Martin Jansen
  8.  *
  9.  * Licensed under the Apache License, Version 2.0 (the "License");
  10.  * you may not use this file except in compliance with the License.
  11.  * You may obtain a copy of the License at
  12.  *
  13.  *     http://www.apache.org/licenses/LICENSE-2.0
  14.  *
  15.  * Unless required by applicable law or agreed to in writing, software
  16.  * distributed under the License is distributed on an "AS IS" BASIS,
  17.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18.  * See the License for the specific language governing permissions and
  19.  * limitations under the License.
  20.  *
  21.  * @category   Services
  22.  * @package    Services_Yahoo
  23.  * @author     Martin Jansen <mj@php.net>
  24.  * @copyright  2005-2006 Martin Jansen
  25.  * @license    http://www.apache.org/licenses/LICENSE-2.0  Apache License, Version 2.0
  26.  * @version    CVS: $Id: local.php,v 1.6 2006/10/04 15:08:56 mj Exp $
  27.  * @link       http://pear.php.net/package/Services_Yahoo
  28.  */
  29.  
  30. require_once "AbstractSearch.php";
  31.  
  32. /**
  33.  * Local search class
  34.  *
  35.  * This class implements an interface to Yahoo's Local search by using
  36.  * the Yahoo API.
  37.  *
  38.  * @category   Services
  39.  * @package    Services_Yahoo
  40.  * @author     Martin Jansen <mj@php.net>
  41.  * @copyright  2005-2006 Martin Jansen
  42.  * @license    http://www.apache.org/licenses/LICENSE-2.0  Apache License, Version 2.0
  43.  * @version    CVS: $Id: local.php,v 1.6 2006/10/04 15:08:56 mj Exp $
  44.  * @link       http://pear.php.net/package/Services_Yahoo
  45.  * @link       http://developer.yahoo.net/local/V1/localSearch.html
  46.  */
  47.  
  48.     protected $requestURL = "http://local.yahooapis.com/LocalSearchService/V3/localSearch";
  49.  
  50.     /** 
  51.      * Set how far (in miles) from the specified location to search for the query terms
  52.      *
  53.      * The default radius varies according to the location given.
  54.      *
  55.      * @access public
  56.      * @param  string Radius as a float number
  57.      * @return Services_Yahoo_AbstractSearch Object which contains the method
  58.      */
  59.     public function inRadius($radius)
  60.     {
  61.         $this->parameters['radius'$radius;
  62.  
  63.         return $this;
  64.     }
  65.     
  66.     /** 
  67.      * Set the street name
  68.      *
  69.      * The number is optional.
  70.      *
  71.      * @access public
  72.      * @param  string Name of the street
  73.      * @return Services_Yahoo_AbstractSearch Object which contains the method
  74.      */
  75.     public function inStreet($street)
  76.     {
  77.         $this->parameters['street'$street;
  78.  
  79.         return $this;
  80.     }
  81.  
  82.     /** 
  83.      * Set the city name
  84.      *
  85.      * @access public
  86.      * @param  string City name
  87.      * @return Services_Yahoo_AbstractSearch Object which contains the method
  88.      */
  89.     public function inCity($city)
  90.     {
  91.         $this->parameters['city'$city;
  92.  
  93.         return $this;
  94.     }
  95.  
  96.     /** 
  97.      * Set the United States state
  98.      *
  99.      * @access public
  100.      * @param  string State name. You can spell out the full state name or you can use the two-letter abbreviation.
  101.      *
  102.      * @link   http://en.wikipedia.org/wiki/State_codes
  103.      * @access public
  104.      * @param  string State name
  105.      * @return Services_Yahoo_AbstractSearch Object which contains the method
  106.      */
  107.     public function inState($state)
  108.     {
  109.         $this->parameters['state'$state;
  110.  
  111.         return $this;
  112.     }
  113.  
  114.     /** 
  115.      * Set the ZIP code
  116.      *
  117.      * The parameter can be a five-digit ZIP code, or the five-digit
  118.      * code plus four-digit extension. If this location contradicts
  119.      * the city and state specified, the ZIP code will be used for
  120.      * determining the location and the city and state will be ignored.
  121.      *
  122.      * @access public
  123.      * @param  string ZIP code as described
  124.      * @return Services_Yahoo_AbstractSearch Object which contains the method
  125.      */
  126.     public function withZIP($code)
  127.     {
  128.         $this->parameters['zip'$code;
  129.  
  130.         return $this;
  131.     }
  132.  
  133.     /** 
  134.      * Set a location description
  135.      *
  136.      * This free field lets users enter any of the following:
  137.      *   - city, state
  138.      *   - city, state, ZIP
  139.      *   - ZIP
  140.      *   - street, city, state
  141.      *   - street, city, state, ZIP
  142.      *   - street, ZIP
  143.      *
  144.      * If location is specified, it will take priority over the
  145.      * individual fields in determining the location for the query.
  146.      * City, state and ZIP will be ignored.
  147.      *
  148.      * @access public
  149.      * @param  string Location description
  150.      * @return Services_Yahoo_AbstractSearch Object which contains the method
  151.      */
  152.     public function atLocation($location)
  153.     {
  154.         $this->parameters['location'$location;
  155.  
  156.         return $this;
  157.     }
  158. }

Documentation generated on Fri, 20 Apr 2007 14:30:06 -0400 by phpDocumentor 1.3.0. PEAR Logo Copyright © PHP Group 2004.