/SignalSlot/src/options/options.php

https://github.com/xc/zetacomponents · PHP · 92 lines · 25 code · 3 blank · 64 comment · 4 complexity · 655cbb498ff1d2b468126232661ccee8 MD5 · raw file

  1. <?php
  2. /**
  3. * File containing the ezcConsoleStatusbarOptions 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 SignalSlot
  23. * @version //autogentag//
  24. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  25. * @filesource
  26. */
  27. /**
  28. * Struct class to store the options of the ezcConsoleOutput class.
  29. * This class stores the options for the {@link ezcSignalCollection} class.
  30. *
  31. * @property array(string) $signals
  32. * The signals that the signal collection can throw. If this option
  33. * is set using a non-existent signal is considered an exceptional state.
  34. * If this option is not set or is set to null then using a non existent
  35. * signal is simply ignored.
  36. *
  37. * @package SignalSlot
  38. * @version //autogen//
  39. */
  40. class ezcSignalCollectionOptions extends ezcBaseOptions
  41. {
  42. /**
  43. * Construct a new options object.
  44. * Options are constructed from an option array by default. The constructor
  45. * automatically passes the given options to the __set() method to set them
  46. * in the class.
  47. *
  48. * @param array(string=>mixed) $options The initial options to set.
  49. * @return void
  50. *
  51. * @throws ezcBasePropertyNotFoundException
  52. * If a the value for the property options is not an instance of
  53. * @throws ezcBaseValueException
  54. * If a the value for a property is out of range.
  55. */
  56. public function __construct( array $options = array() )
  57. {
  58. $this->properties['signals'] = null;
  59. parent::__construct( $options );
  60. }
  61. /**
  62. * Option write access.
  63. *
  64. * @throws ezcBasePropertyNotFoundException
  65. * If a desired property could not be found.
  66. * @throws ezcBaseSettingValueException
  67. * If a desired property value is out of range.
  68. *
  69. * @param string $key Name of the property.
  70. * @param mixed $value The value for the property.
  71. * @ignore
  72. */
  73. public function __set( $key, $value )
  74. {
  75. switch ( $key )
  76. {
  77. case "signals":
  78. if ( $value != null && !is_array( $value ) )
  79. {
  80. throw new ezcBaseSettingValueException( $key, $value, 'null, array(string)' );
  81. }
  82. break;
  83. default:
  84. throw new ezcBaseSettingNotFoundException( $key );
  85. }
  86. $this->properties[$key] = $value;
  87. }
  88. }
  89. ?>