## Apache Zeta Components Manual :: File Source for group_options.php

## Source for file group_options.php

Documentation is available at group_options.php

1. <?php
2. /**
3. * File containing the ezcAuthenticationGroupOptions 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. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
23. * @filesource
24. * @package Authentication
25. * @version //autogen//
26. */
28. /**
29. * Class containing the options for group authentication filter.
30. *
31. * Example of use:
32. * <code>
33. * $options = new ezcAuthenticationGroupOptions();
34. * $options->mode = ezcAuthenticationGroupFilter::MODE_AND;
35. * $options->mode->multipleCredentials = false;
36. *
37. * // $filter1 and $filter2 are authentication filters which need all to succeed
38. * // in order for the group to succeed
39. * $filter = new ezcAuthenticationGroupFilter( array( $filter1, $filter2 ), $options );
40. * </code>
41. *
42. * @property int $mode
43. * The way of grouping the authentication filters. Possible values:
44. * - ezcAuthenticationGroupFilter::MODE_OR (default): at least one
45. * filter in the group needs to succeed in order for the group to
46. * succeed.
47. * - ezcAuthenticationGroupFilter::MODE_AND: all filters in the group
48. * need to succeed in order for the group to succeed.
49. * @property bool $multipleCredentials
50. * If enabled (set to true), each filter must be added to the group
51. * along with a credentials object (through the constructor or with
52. * addFilter()). By default is false (the credentials from the
53. * ezcAuthentication object are used for all filters in the group).
54. *
55. * @package Authentication
56. * @version //autogen//
57. */
58. class ezcAuthenticationGroupOptions extends ezcAuthenticationFilterOptions
59. {
60. /**
61. * Constructs an object with the specified values.
62. *
63. * @throws ezcBasePropertyNotFoundException
64. * if $options contains a property not defined
65. * @throws ezcBaseValueException
66. * if $options contains a property with a value not allowed
67. * @param array(string=>mixed) $options Options for this class
68. */
69. public function __construct ( array $options = array() )
70. {
71. $this->mode = ezcAuthenticationGroupFilter ::MODE_OR;
72. $this->multipleCredentials = false;
74. parent:: __construct ( $options );
75. }
77. /**
78. * Sets the option $name to $value.
79. *
80. * @throws ezcBasePropertyNotFoundException
81. * if the property $name is not defined
82. * @throws ezcBaseValueException
83. * if $value is not correct for the property $name
84. * @param string $name The name of the property to set
85. * @param mixed $value The new value of the property
86. * @ignore
87. */
88. public function __set( $name, $value )
89. {
90. switch ( $name )
91. {
92. case 'mode':
93. $modes = array(
94. ezcAuthenticationGroupFilter ::MODE_OR,
95. ezcAuthenticationGroupFilter ::MODE_AND
96. );
97. if ( ! in_array ( $value, $modes, true ) )
98. {
99. throw new ezcBaseValueException ( $name, $value, implode ( ', ', $modes ) );
100. }
101. $this-> properties [$name] = $value;
102. break;
104. case 'multipleCredentials':
105. if ( ! is_bool ( $value ) )
106. {
107. throw new ezcBaseValueException ( $name, $value, 'bool' );
108. }
109. $this-> properties [$name] = $value;
110. break;
112. default:
113. parent::__set( $name, $value );
114. }
115. }
116. }
117. ?>

Documentation generated by phpDocumentor 1.4.3