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

Source for file News.php

Documentation is available at News.php

  1. <?php
  2. /**
  3.  * News 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: News.php,v 1.1 2008/04/28 15:59:31 tetsuya Exp $
  19.  * @link      http://phpize.net
  20.  */
  21.  
  22. require_once "Services/Yahoo/Exception.php";
  23.  
  24. /**
  25.  * News dispatcher class
  26.  *
  27.  * This class provides a method to create a concrete instance of one
  28.  * of the supported News types (topics).
  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. {
  39.     /**
  40.      * Attempts to return a concrete instance of a News class
  41.      *
  42.      * @param string $type Can be one of topics.
  43.      *
  44.      * @return  object Concrete instance of a News class based on the paramter
  45.      * @throws  Services_Yahoo_Exception
  46.      */
  47.     public function factory($type)
  48.     {
  49.         switch ($type{
  50.         case 'topics' :
  51.             include_once 'Services/Yahoo/JP/News/' $type '.php';
  52.             $classname 'Services_Yahoo_JP_News_' ucfirst($type);
  53.             return new $classname;
  54.         default :
  55.             throw new Services_Yahoo_Exception('Unknown news type ' $type);
  56.             break;
  57.         }
  58.     }
  59. }
  60. ?>

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