[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/library/ezc/Base/src/options/ -> autoload.php (source)

   1  <?php
   2  /**
   3   * File containing the ezcBaseAutoloadOptions class
   4   *
   5   * @package Base
   6   * @version 1.8
   7   * @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
   8   * @license http://ez.no/licenses/new_bsd New BSD License
   9   */
  10  
  11  /**
  12   * Class containing the basic options for ezcBase' autoload.
  13   *
  14   * @property bool $preload
  15   *           If component preloading is enabled then as soon as one of the
  16   *           classes of a component is request, all other classes in the
  17   *           component are loaded as well (except for Exception classes).
  18   * @property bool $debug
  19   *           If debug is enabled then the autoload method will show exceptions
  20   *           when a class can not be found. Because exceptions are ignored by
  21   *           PHP in the autoload handler, you have to catch them in autoload()
  22   *           yourself and do something with the exception message.
  23   *
  24   * @package Base
  25   * @version 1.8
  26   */
  27  class ezcBaseAutoloadOptions extends ezcBaseOptions
  28  {
  29      /**
  30       * Constructs an object with the specified values.
  31       *
  32       * @throws ezcBasePropertyNotFoundException
  33       *         if $options contains a property not defined
  34       * @throws ezcBaseValueException
  35       *         if $options contains a property with a value not allowed
  36       * @param array(string=>mixed) $options
  37       */
  38      public function __construct( array $options = array() )
  39      {
  40          $this->preload = false;
  41          $this->debug = false;
  42  
  43          parent::__construct( $options );
  44      }
  45  
  46      /**
  47       * Sets the option $name to $value.
  48       *
  49       * @throws ezcBasePropertyNotFoundException
  50       *         if the property $name is not defined
  51       * @throws ezcBaseValueException
  52       *         if $value is not correct for the property $name
  53       * @param string $name
  54       * @param mixed $value
  55       * @ignore
  56       */
  57      public function __set( $name, $value )
  58      {
  59          switch ( $name )
  60          {
  61              case 'debug':
  62              case 'preload':
  63                  if ( !is_bool( $value ) )
  64                  {
  65                      throw new ezcBaseValueException( $name, $value, 'bool' );
  66                  }
  67                  $this->properties[$name] = $value;
  68                  break;
  69  
  70              default:
  71                  throw new ezcBasePropertyNotFoundException( $name );
  72          }
  73      }
  74  }
  75  ?>


Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7