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

## Source for file session_options.php

Documentation is available at session_options.php

1. <?php
2. /**
3. * File containing the ezcAuthenticationSessionOptions 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 the authentication session.
30. *
31. * Example of use:
32. * <code>
33. * // create an options object
34. * $options = new ezcAuthenticationSessionOptions();
35. * $options->validity = 60;
36. * $options->idKey = 'xxx';
37. * $options->timestampKey = 'yyy';
38. *
39. * // use the options object when creating a new Session object
40. * $filter = new ezcAuthenticationSession( $options );
41. *
42. * // alternatively, you can set the options to an existing object
43. * $filter = new ezcAuthenticationSession();
44. * $filter->setOptions( $options );
45. * </code>
46. *
47. * @property int $validity
48. * The amount of seconds the session can be idle.
49. * @property string $idKey
50. * The key to use in $_SESSION to hold the user ID of the user who is
51. * logged in.
52. * @property string $timestampKey
53. * The key to use in $_SESSION to hold the authentication timestamp.
54. *
55. * @package Authentication
56. * @version //autogen//
57. */
58. class ezcAuthenticationSessionOptions extends ezcBaseOptions
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->validity = 1200; // seconds
72. $this->idKey = 'ezcAuth_id';
73. $this->timestampKey = 'ezcAuth_timestamp';
75. parent:: __construct ( $options );
76. }
78. /**
79. * Sets the option $name to $value.
80. *
81. * @throws ezcBasePropertyNotFoundException
82. * if the property $name is not defined
83. * @throws ezcBaseValueException
84. * if $value is not correct for the property $name
85. * @param string $name The name of the property to set
86. * @param mixed $value The new value of the property
87. * @ignore
88. */
89. public function __set( $name, $value )
90. {
91. switch ( $name )
92. {
93. case 'validity':
94. if ( ! is_numeric ( $value ) || ( $value < 1 ) )
95. {
96. throw new ezcBaseValueException ( $name, $value, 'int >= 1' );
97. }
98. $this-> properties [$name] = $value;
99. break;
101. case 'idKey':
102. case 'timestampKey':
103. if ( ! is_string ( $value ) )
104. {
105. throw new ezcBaseValueException ( $name, $value, 'string' );
106. }
107. $this-> properties [$name] = $value;
108. break;
110. default:
111. throw new ezcBasePropertyNotFoundException ( $name );
112. }
113. }
114. }
115. ?>

Documentation generated by phpDocumentor 1.4.3