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

Source for file Search.php

Documentation is available at Search.php

  1. <?php
  2. /**
  3.  * Search dispatcher
  4.  *
  5.  * PHP version 5
  6.  *
  7.  * LICENSE: This source file is subject to the New BSD license that is
  8.  * available through the world-wide-web at the following URI:
  9.  * http://www.opensource.org/licenses/bsd-license.php. If you did not receive
  10.  * a copy of the New BSD License and are unable to obtain it through the web,
  11.  * please send a note to license@php.net so we can mail you a copy immediately.
  12.  *
  13.  * @category  Services
  14.  * @package   Services_Yahoo_JP
  15.  * @author    Tetsuya Nakase <phpizer@gmail.com>
  16.  * @copyright 2008 Tetsuya Nakase
  17.  * @license   http://www.opensource.org/licenses/bsd-license.php BSD
  18.  * @version   CVS: $Id: Search.php,v 1.1 2008/04/28 15:59:31 tetsuya Exp $
  19.  * @link      http://phpize.net
  20.  */
  21.  
  22. require_once 'Services/Yahoo/Search.php';
  23.  
  24. /**
  25.  * Search dispatcher class
  26.  *
  27.  * This class provides a method to create a concrete instance of one
  28.  * of the supported search types (Web, Images, Videos).
  29.  *
  30.  * @category  Services
  31.  * @package   Services_Yahoo_JP
  32.  * @author    Tetsuya Nakase <phpizer@gmail.com>
  33.  * @copyright 2008 Tetsuya Nakase
  34.  * @license   http://www.opensource.org/licenses/bsd-license.php BSD
  35.  * @version   Release: 0.0.1
  36.  * @link      http://phpize.net
  37.  */
  38. class Services_Yahoo_JP_Search extends Services_Yahoo_Search
  39. {
  40.     /**
  41.      * Attempts to return a concrete instance of a search class
  42.      *
  43.      * @param string $type Can be one of web, image or video
  44.      *
  45.      * @return  object Concrete instance of a search class based on the paramter
  46.      * @throws  Services_Yahoo_Exception
  47.      */
  48.     public function factory($type)
  49.     {
  50.         switch ($type{
  51.         case 'web' :
  52.         case 'image' :
  53.         case 'video' :
  54.             include_once 'Services/Yahoo/JP/Search/' $type '.php';
  55.             $classname 'Services_Yahoo_JP_Search_' ucfirst($type);
  56.             return new $classname;
  57.         default :
  58.             throw new Services_Yahoo_Exception('Unknown search type ' $type);
  59.             break;
  60.         }
  61.     }
  62. }
  63. ?>

Documentation generated on Fri, 19 Sep 2008 21:30:07 -0400 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.