## 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. */
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. class ezcConsoleOutputOptions extends ezcBaseOptions
46. {
47. /**
48. * Construct a new options object.
49. *
50. * NOTE: For BC reasons the old method of instanciating this class is kept,
51. * but the usage of the new version is highly encouraged.
52. *
53. * @param array(string=>mixed) $options The initial options to set.
54. * @return void
55. *
56. * @throws ezcBasePropertyNotFoundException
57. * If a the value for the property options is not an instance of
58. * @throws ezcBaseValueException
59. * If a the value for a property is out of range.
60. */
61. public function __construct ()
62. {
63. $this-> properties ['verbosityLevel'] = 1;
64. $this-> properties ['autobreak'] = 0;
65. $this-> properties ['useFormats'] = true;
66. $args = func_get_args ();
67. if ( func_num_args () === 1 && is_array ( $args[0] ) )
68. {
69. parent:: __construct ( $args[0] );
70. }
71. else
72. {
73. foreach ( $args as $id => $val )
74. {
75. switch ( $id )
76. {
77. case 0:
78. $this->__set( "verbosityLevel", $val );
79. break;
80. case 1:
81. $this->__set( "autobreak", $val );
82. break;
83. case 2:
84. $this->__set( "useFormats", $val );
85. break;
86. }
87. }
88. }
89. }
91. /**
92. * Property write access.
93. *
94. * @throws ezcBasePropertyNotFoundException
95. * If a desired property could not be found.
96. * @throws ezcBaseValueException
97. * If a desired property value is out of range.
98. *
99. * @param string $propertyName Name of the property.
100. * @param mixed $val The value for the property.
101. * @ignore
102. */
103. public function __set( $propertyName, $val )
104. {
105. switch ( $propertyName )
106. {
107. case 'verbosityLevel':
108. case 'autobreak':
109. if ( ! is_int ( $val ) || $val < 0 )
110. {
111. throw new ezcBaseValueException ( $propertyName, $val, 'int >= 0' );
112. }
113. break;
114. case 'useFormats':
115. if ( ! is_bool ( $val ) )
116. {
117. throw new ezcBaseValueException ( $propertyName, $val, 'bool' );
118. }
119. break;
120. default:
121. throw new ezcBasePropertyNotFoundException ( $propertyName );
122. }
123. $this-> properties [$propertyName] = $val;
124. }
125. }
127. ?>

Documentation generated by phpDocumentor 1.4.3