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

Source for file DecoratedList.php

Documentation is available at DecoratedList.php

  1. <?php
  2. // +----------------------------------------------------------------------+
  3. // | PEAR :: I18Nv2 :: DecoratedList                                      |
  4. // +----------------------------------------------------------------------+
  5. // | This source file is subject to version 3.0 of the PHP license,       |
  6. // | that is available at http://www.php.net/license/3_0.txt              |
  7. // | If you did not receive a copy of the PHP license and are unable      |
  8. // | to obtain it through the world-wide-web, please send a note to       |
  9. // | license@php.net so we can mail you a copy immediately.               |
  10. // +----------------------------------------------------------------------+
  11. // | Copyright (c) 2004 Michael Wallner <mike@iworks.at>                  |
  12. // +----------------------------------------------------------------------+
  13. //
  14. // $Id: DecoratedList.php,v 1.4 2004/06/01 17:51:21 mike Exp $
  15.  
  16. /**
  17. * I18Nv2_DecoratedList
  18. *
  19. @author       Michael Wallner <mike@php.net>
  20. @version      $Revision: 1.4 $
  21. @package      I18Nv2
  22. */
  23. {
  24.     /**
  25.     * I18Nv2_(Common|Decorated)List
  26.     * 
  27.     * @access   protected
  28.     * @var      object 
  29.     */
  30.     var $list;
  31.     
  32.     /**
  33.     * Constructor
  34.     * 
  35.     * @access   public
  36.     * @return   object 
  37.     * @param    object  $list   I18Nv2_DecoratedList or I18Nv2_CommonList
  38.     */
  39.     function I18Nv2_DecoratedList(&$list)
  40.     {
  41.         I18Nv2_DecoratedList::__construct($list);
  42.     }
  43.     
  44.     /**
  45.     * ZE2 Constructor
  46.     * @ignore
  47.     */
  48.     function __construct(&$list)
  49.     {
  50.         if (is_a($list'I18Nv2_CommonList'||
  51.             is_a($list'I18Nv2_DecoratedList')) {
  52.             $this->list = &$list;
  53.         }
  54.     }
  55.  
  56.     /** 
  57.     * Get all codes
  58.     * 
  59.     * @access   public
  60.     * @return   array 
  61.     */
  62.     function getAllCodes()
  63.     {
  64.         return $this->decorate($this->list->getAllCodes());
  65.     }
  66.     
  67.     /** 
  68.     * Check if code is valid
  69.     * 
  70.     * @access   public
  71.     * @return   bool 
  72.     * @param    string  $code 
  73.     */
  74.     function isValidCode($code)
  75.     {
  76.         return $this->decorate($this->list->isValidCode($code));
  77.     }
  78.     
  79.     /** 
  80.     * Get name for code
  81.     * 
  82.     * @access   public
  83.     * @return   string 
  84.     * @param    string  $code 
  85.     */
  86.     function getName($code)
  87.     {
  88.         return $this->decorate($this->list->getName($code));
  89.     }
  90.     
  91.     /**
  92.     * decorate
  93.     * 
  94.     * @abstract
  95.     * @access   protected
  96.     * @return   mixed 
  97.     * @param    mixed   $value 
  98.     */
  99.     function decorate($value)
  100.     {
  101.         return $value;
  102.     }
  103.  
  104.     /**
  105.     * Decorate this list
  106.     *
  107.     * @access   public
  108.     * @return   object  I18NV2_DecoratedList 
  109.     * @param    string  $type 
  110.     */
  111.     function &toDecoratedList($type)
  112.     {
  113.         require_once 'I18Nv2/DecoratedList/'$type .'.php';
  114.         $decoratedList 'I18Nv2_DecoratedList_' $type;
  115.         return new $decoratedList($this);
  116.     }
  117. }
  118. ?>

Documentation generated on Mon, 11 Mar 2019 13:54:49 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.