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

Source for file Search.php

Documentation is available at Search.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  3.  
  4. /**
  5.  * Search dispatcher
  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: Search.php,v 1.5 2006/10/04 14:29:56 mj Exp $
  27.  * @link       http://pear.php.net/package/Services_Yahoo
  28.  */
  29.  
  30. require_once "Services/Yahoo/Exception.php";
  31.  
  32. /**
  33.  * Search dispatcher class
  34.  *
  35.  * This class provides a method to create a concrete instance of one
  36.  * of the supported search types (Web, Images, Videos, News, Local).
  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: Search.php,v 1.5 2006/10/04 14:29:56 mj Exp $
  44.  */
  45.  
  46.     /**
  47.      * Attempts to return a concrete instance of a search class
  48.      *
  49.      * @access  public
  50.      * @param   string Type of search. Can be one of web, image, news, video or local
  51.      * @return  object Concrete instance of a search class based on the paramter
  52.      * @throws  Services_Yahoo_Exception
  53.      */
  54.     public function factory($type)
  55.     {
  56.         switch ($type{
  57.  
  58.         case "web" :
  59.         case "image" :
  60.         case "news" :
  61.         case "video" :
  62.         case "local" :
  63.             require_once "Services/Yahoo/Search/" $type ".php";
  64.             $classname "Services_Yahoo_Search_" $type;
  65.             return new $classname;
  66.  
  67.         default :
  68.             throw new Services_Yahoo_Exception("Unknown search type {$type}");
  69.         }
  70.     }
  71. }

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