/**
  * Sets the option $name to $value.
  *
  * @throws ezcBasePropertyNotFoundException
  *         if the property $name is not defined
  * @throws ezcBaseValueException
  *         if $value is not correct for the property $name
  * @param string $name The name of the property to set
  * @param mixed $value The new value of the property
  * @ignore
  */
 public function __set($name, $value)
 {
     switch ($name) {
         default:
             parent::__set($name, $value);
     }
 }
示例#2
0
 /**
  * Sets the option $name to $value.
  *
  * @throws ezcBasePropertyNotFoundException
  *         if the property $name is not defined
  * @throws ezcBaseValueException
  *         if $value is not correct for the property $name
  * @param string $name The name of the property to set
  * @param mixed $value The new value of the property
  * @ignore
  */
 public function __set($name, $value)
 {
     switch ($name) {
         case 'plain':
             if (!is_bool($value)) {
                 throw new ezcBaseValueException($name, $value, 'bool');
             }
             $this->properties[$name] = $value;
             break;
         default:
             parent::__set($name, $value);
     }
 }
示例#3
0
 /**
  * Sets the option $name to $value.
  *
  * @throws ezcBasePropertyNotFoundException
  *         if the property $name is not defined
  * @throws ezcBaseValueException
  *         if $value is not correct for the property $name
  * @param string $name The name of the property to set
  * @param mixed $value The new value of the property
  * @ignore
  */
 public function __set($name, $value)
 {
     switch ($name) {
         case 'protocol':
             $allowedValues = array(ezcAuthenticationLdapFilter::PROTOCOL_PLAIN, ezcAuthenticationLdapFilter::PROTOCOL_TLS);
             if (!in_array($value, $allowedValues, true)) {
                 throw new ezcBaseValueException($name, $value, implode(', ', $allowedValues));
             }
             $this->properties[$name] = $value;
             break;
         default:
             parent::__set($name, $value);
     }
 }
示例#4
0
 /**
  * Sets the option $name to $value.
  *
  * @throws ezcBasePropertyNotFoundException
  *         if the property $name is not defined
  * @throws ezcBaseValueException
  *         if $value is not correct for the property $name
  * @param string $name The name of the property to set
  * @param mixed $value The new value of the property
  * @ignore
  */
 public function __set($name, $value)
 {
     switch ($name) {
         case 'mode':
             $allowedValues = array(ezcAuthenticationOpenidFilter::MODE_DUMB, ezcAuthenticationOpenidFilter::MODE_SMART);
             if (!in_array($value, $allowedValues, true)) {
                 throw new ezcBaseValueException($name, $value, implode(', ', $allowedValues));
             }
             $this->properties[$name] = $value;
             break;
         case 'store':
             if ($value !== null && !$value instanceof ezcAuthenticationOpenidStore) {
                 throw new ezcBaseValueException($name, $value, 'ezcAuthenticationOpenidStore || null');
             }
             $this->properties[$name] = $value;
             break;
         case 'nonceKey':
             if (!is_string($value)) {
                 throw new ezcBaseValueException($name, $value, 'string');
             }
             $this->properties[$name] = $value;
             break;
         case 'nonceLength':
         case 'nonceValidity':
         case 'timeout':
         case 'timeoutOpen':
             if (!is_numeric($value) || $value < 1) {
                 throw new ezcBaseValueException($name, $value, 'int >= 1');
             }
             $this->properties[$name] = $value;
             break;
         case 'requestSource':
             if (!is_array($value)) {
                 throw new ezcBaseValueException($name, $value, 'array');
             }
             $this->properties[$name] = $value;
             break;
         case 'immediate':
             if (!is_bool($value)) {
                 throw new ezcBaseValueException($name, $value, 'bool');
             }
             $this->properties[$name] = $value;
             break;
         case 'returnUrl':
             if (!is_string($value) && !is_null($value)) {
                 throw new ezcBaseValueException($name, $value, 'string');
             }
             $this->properties[$name] = $value;
             break;
         default:
             parent::__set($name, $value);
     }
 }
 /**
  * Sets the option $name to $value.
  *
  * @throws ezcBasePropertyNotFoundException
  *         if the property $name is not defined
  * @throws ezcBaseValueException
  *         if $value is not correct for the property $name
  * @param string $name The name of the property to set
  * @param mixed $value The new value of the property
  * @ignore
  */
 public function __set($name, $value)
 {
     switch ($name) {
         case 'mode':
             $modes = array(ezcAuthenticationGroupFilter::MODE_OR, ezcAuthenticationGroupFilter::MODE_AND);
             if (!in_array($value, $modes, true)) {
                 throw new ezcBaseValueException($name, $value, implode(', ', $modes));
             }
             $this->properties[$name] = $value;
             break;
         case 'multipleCredentials':
             if (!is_bool($value)) {
                 throw new ezcBaseValueException($name, $value, 'bool');
             }
             $this->properties[$name] = $value;
             break;
         default:
             parent::__set($name, $value);
     }
 }
示例#6
0
 /**
  * Sets the option $name to $value.
  *
  * @throws ezcBasePropertyNotFoundException
  *         if the property $name is not defined
  * @throws ezcBaseValueException
  *         if $value is not correct for the property $name
  * @throws ezcBaseFileNotFoundException
  *         if the $value file does not exist
  * @throws ezcBaseFilePermissionException
  *         if the $value file cannot be opened for reading
  * @param string $name The name of the property to set
  * @param mixed $value The new value of the property
  * @ignore
  */
 public function __set($name, $value)
 {
     switch ($name) {
         case 'validity':
             if (!is_numeric($value) || $value < 0) {
                 throw new ezcBaseValueException($name, $value, 'int >= 0');
             }
             $this->properties[$name] = $value;
             break;
         case 'keysFile':
             if (!is_string($value)) {
                 throw new ezcBaseValueException($name, $value, 'string');
             }
             if (strpos($value, '://') === false) {
                 // if $value is not an URL
                 if (!file_exists($value)) {
                     throw new ezcBaseFileNotFoundException($value);
                 }
                 if (!is_readable($value)) {
                     throw new ezcBaseFilePermissionException($value, ezcBaseFileException::READ);
                 }
             } else {
                 // if $value is an URL
                 // hide the notices caused by getaddrinfo (php_network_getaddresses)
                 // in case of unreachable hosts ("Name or service not known")
                 $headers = @get_headers($value);
                 if ($headers === false || count($headers) === 0 || strpos($headers[0], '404 Not Found') !== false) {
                     throw new ezcBaseFileNotFoundException($value);
                 }
             }
             $this->properties[$name] = $value;
             break;
         case 'requestSource':
             if (!is_array($value)) {
                 throw new ezcBaseValueException($name, $value, 'array');
             }
             $this->properties[$name] = $value;
             break;
         default:
             parent::__set($name, $value);
     }
 }