Apache Zeta Components Manual :: File Source for output.php

Source for file output.php

Documentation is available at output.php

  1. <?php
  2. /**
  3.  * File containing the ezcConsoleOutputOptions class.
  4.  *
  5.  * Licensed to the Apache Software Foundation (ASF) under one
  6.  * or more contributor license agreements.  See the NOTICE file
  7.  * distributed with this work for additional information
  8.  * regarding copyright ownership.  The ASF licenses this file
  9.  * to you under the Apache License, Version 2.0 (the
  10.  * "License"); you may not use this file except in compliance
  11.  * with the License.  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,
  16.  * software distributed under the License is distributed on an
  17.  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  18.  * KIND, either express or implied.  See the License for the
  19.  * specific language governing permissions and limitations
  20.  * under the License.
  21.  *
  22.  * @package ConsoleTools
  23.  * @version //autogentag//
  24.  * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  25.  * @filesource
  26.  */
  27.  
  28. /**
  29.  * Struct class to store the options of the ezcConsoleOutput class.
  30.  *
  31.  * This class stores the options for the {@link ezcConsoleOutput} class.
  32.  *
  33.  * @property int $verbosityLevel 
  34.  *            Determines the level of verbosity.
  35.  * @property int $autobreak 
  36.  *            Determines, whether text is automatically wrapped after a
  37.  *            specific amount of characters in a line. If set to 0
  38.  *            (default), lines will not be wrapped automatically.
  39.  * @property bool $useFormats 
  40.  *            Whether to use formatting or not.
  41.  * 
  42.  * @package ConsoleTools
  43.  * @version //autogen//
  44.  */
  45. {
  46.     /**
  47.      * Construct a new options object.
  48.      *
  49.      * NOTE: For BC reasons the old method of instanciating this class is kept,
  50.      * but the usage of the new version is highly encouraged.
  51.      * 
  52.      * @param array(string=>mixed) $options The initial options to set.
  53.      * @return void 
  54.      *
  55.      * @throws ezcBasePropertyNotFoundException
  56.      *          If a the value for the property options is not an instance of
  57.      * @throws ezcBaseValueException
  58.      *          If a the value for a property is out of range.
  59.      */
  60.     public function __construct()
  61.     {
  62.         $this->properties['verbosityLevel'1;
  63.         $this->properties['autobreak'0;
  64.         $this->properties['useFormats'true;
  65.         $args func_get_args();
  66.         if func_num_args(=== && is_array$args[0) )
  67.         {
  68.             parent::__construct$args[0);
  69.         }
  70.         else
  71.         {
  72.             foreach $args as $id => $val )
  73.             {
  74.                 switch $id )
  75.                 {
  76.                     case 0:
  77.                         $this->__set"verbosityLevel"$val );
  78.                         break;
  79.                     case 1:
  80.                         $this->__set"autobreak"$val );
  81.                         break;
  82.                     case 2:
  83.                         $this->__set"useFormats"$val );
  84.                         break;
  85.                 }
  86.             }
  87.         }
  88.     }
  89.  
  90.     /**
  91.      * Property write access.
  92.      * 
  93.      * @throws ezcBasePropertyNotFoundException
  94.      *          If a desired property could not be found.
  95.      * @throws ezcBaseValueException
  96.      *          If a desired property value is out of range.
  97.      *
  98.      * @param string $propertyName Name of the property.
  99.      * @param mixed $val  The value for the property.
  100.      * @ignore
  101.      */
  102.     public function __set$propertyName$val )
  103.     {
  104.         switch $propertyName )
  105.         {
  106.             case 'verbosityLevel':
  107.             case 'autobreak':
  108.                 if !is_int$val || $val )
  109.                 {
  110.                     throw new ezcBaseValueException$propertyName$val'int >= 0' );
  111.                 }
  112.                 break;
  113.             case 'useFormats':
  114.                 if !is_bool$val ) )
  115.                 {
  116.                     throw new ezcBaseValueException$propertyName$val'bool' );
  117.                 }
  118.                 break;
  119.             default:
  120.                 throw new ezcBasePropertyNotFoundException$propertyName );
  121.         }
  122.         $this->properties[$propertyName$val;
  123.     }
  124. }
  125.  
  126. ?>
Documentation generated by phpDocumentor 1.4.3