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

Source for file question_dialog.php

Documentation is available at question_dialog.php

  1. <?php
  2. /**
  3.  * File containing the ezcConsoleQuestionDialogOptions 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.  * Basic options class for ezcConsoleDialog implementations.
  30.  * 
  31.  * @package ConsoleTools
  32.  * @version //autogen//
  33.  *
  34.  * @property string $text 
  35.  *            The question itself.
  36.  * @property ezcConsoleQuestionDialogValidator $validator 
  37.  *            The validator to use with this dialog.
  38.  * @property bool $showResults 
  39.  *            Wether to display the possible results and the default selection.
  40.  * @property string $format 
  41.  *            The output format for the dialog.
  42.  */
  43. {
  44.  
  45.     /**
  46.      * Construct a new options object.
  47.      * Options are constructed from an option array by default. The constructor
  48.      * automatically passes the given options to the __set() method to set them
  49.      * in the class.
  50.      * 
  51.      * @throws ezcBasePropertyNotFoundException
  52.      *          If trying to access a non existent property.
  53.      * @throws ezcBaseValueException
  54.      *          If the value for a property is out of range.
  55.      * @param array(string=>mixed) $options The initial options to set.
  56.      */
  57.     public function __constructarray $options array() )
  58.     {
  59.         $this->properties["text"]           "Please enter a value: ";
  60.         $this->properties["validator"]      new ezcConsoleQuestionDialogTypeValidator();
  61.         $this->properties["showResults"false;
  62.         parent::__construct$options );
  63.     }
  64.  
  65.     /**
  66.      * Property write access.
  67.      * 
  68.      * @param string $propertyName Name of the property.
  69.      * @param mixed $propertyValue The value for the property.
  70.      *
  71.      * @throws ezcBasePropertyPermissionException
  72.      *          If the property you try to access is read-only.
  73.      * @throws ezcBasePropertyNotFoundException
  74.      *          If the the desired property is not found.
  75.      * @ignore
  76.      */
  77.     public function __set$propertyName$propertyValue )
  78.     {
  79.         switch $propertyName )
  80.         {
  81.             case "text":
  82.                 if is_string$propertyValue === false || strlen$propertyValue )
  83.                 {
  84.                     throw new ezcBaseValueException(
  85.                         $propertyName,
  86.                         $propertyValue,
  87.                         "string, length > 0"
  88.                     );
  89.                 }
  90.                 break;
  91.             case "showResults":
  92.                 if is_bool$propertyValue === false )
  93.                 {
  94.                     throw new ezcBaseValueException$propertyName$propertyValue"bool" );
  95.                 }
  96.                 break;
  97.             case "validator":
  98.                 if ( ( $propertyValue instanceof ezcConsoleQuestionDialogValidator === false )
  99.                 {
  100.                     throw new ezcBaseValueException$propertyName$propertyValue"ezcConsoleQuestionDialogValidator" );
  101.                 }
  102.                 break;
  103.             default:
  104.                 parent::__set$propertyName$propertyValue );
  105.                 return;
  106.         }
  107.         $this->properties[$propertyName$propertyValue;
  108.     }
  109. }
  110.  
  111. ?>
Documentation generated by phpDocumentor 1.4.3