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.  */
  27.  
  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. {
  59.     /**
  60.      * Constructs an object with the specified values.
  61.      *
  62.      * @throws ezcBasePropertyNotFoundException
  63.      *          if $options contains a property not defined
  64.      * @throws ezcBaseValueException
  65.      *          if $options contains a property with a value not allowed
  66.      * @param array(string=>mixed) $options Options for this class
  67.      */
  68.     public function __constructarray $options array() )
  69.     {
  70.         $this->validity 1200// seconds
  71.         $this->idKey 'ezcAuth_id';
  72.         $this->timestampKey 'ezcAuth_timestamp';
  73.  
  74.         parent::__construct$options );
  75.     }
  76.  
  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 'validity':
  93.                 if !is_numeric$value || $value ) )
  94.                 {
  95.                     throw new ezcBaseValueException$name$value'int >= 1' );
  96.                 }
  97.                 $this->properties[$name$value;
  98.                 break;
  99.  
  100.             case 'idKey':
  101.             case 'timestampKey':
  102.                 if !is_string$value ) )
  103.                 {
  104.                     throw new ezcBaseValueException$name$value'string' );
  105.                 }
  106.                 $this->properties[$name$value;
  107.                 break;
  108.  
  109.             default:
  110.                 throw new ezcBasePropertyNotFoundException$name );
  111.         }
  112.     }
  113. }
  114. ?>
Documentation generated by phpDocumentor 1.4.3