ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilUserPasswordEncoderFactory Class Reference
+ Collaboration diagram for ilUserPasswordEncoderFactory:

Public Member Functions

 __construct (array $config=array())
 getDefaultEncoder ()
 setDefaultEncoder ($default_encoder)
 getEncoders ()
 setEncoders (array $encoders)
 getSupportedEncoderNames ()
 getEncoderByName ($name, $get_default_on_mismatch=false)

Protected Attributes

 $default_encoder
 $encoders = array()

Detailed Description

Definition at line 11 of file class.ilUserPasswordEncoderFactory.php.

Constructor & Destructor Documentation

ilUserPasswordEncoderFactory::__construct ( array  $config = array())
Parameters
array$config

Definition at line 26 of file class.ilUserPasswordEncoderFactory.php.

References setDefaultEncoder().

{
if(!empty($config))
{
foreach($config as $key => $value)
{
switch(strtolower($key))
{
case 'default_password_encoder':
$this->setDefaultEncoder($value);
break;
}
}
}
$this->initEncoders($config);
}

+ Here is the call graph for this function:

Member Function Documentation

ilUserPasswordEncoderFactory::getDefaultEncoder ( )
Returns
string

Definition at line 77 of file class.ilUserPasswordEncoderFactory.php.

References $default_encoder.

Referenced by getEncoderByName().

+ Here is the caller graph for this function:

ilUserPasswordEncoderFactory::getEncoderByName (   $name,
  $get_default_on_mismatch = false 
)
Parameters
string$name
bool$get_default_on_mismatch
Returns
ilPasswordEncoder
Exceptions
ilUserException

Definition at line 129 of file class.ilUserPasswordEncoderFactory.php.

References getDefaultEncoder().

{
if(!isset($this->encoders[$name]))
{
if(!$get_default_on_mismatch)
{
throw new ilUserException(sprintf('The encoder "%s" was not configured.', $name));
}
else if(!$this->getDefaultEncoder())
{
throw new ilUserException('No default encoder specified, fallback not possible.');
}
else if(!isset($this->encoders[$this->getDefaultEncoder()]))
{
throw new ilUserException("No default encoder found for name: '{$this->getDefaultEncoder()}'.");
}
return $this->encoders[$this->getDefaultEncoder()];
}
return $this->encoders[$name];
}

+ Here is the call graph for this function:

ilUserPasswordEncoderFactory::getEncoders ( )
Returns
ilPasswordEncoder[]

Definition at line 93 of file class.ilUserPasswordEncoderFactory.php.

References $encoders.

Referenced by getSupportedEncoderNames().

{
}

+ Here is the caller graph for this function:

ilUserPasswordEncoderFactory::getSupportedEncoderNames ( )
Returns
string[]

Definition at line 118 of file class.ilUserPasswordEncoderFactory.php.

References getEncoders().

{
return array_keys($this->getEncoders());
}

+ Here is the call graph for this function:

ilUserPasswordEncoderFactory::setDefaultEncoder (   $default_encoder)
Parameters
string$default_encoder

Definition at line 85 of file class.ilUserPasswordEncoderFactory.php.

References $default_encoder.

Referenced by __construct().

{
$this->default_encoder = $default_encoder;
}

+ Here is the caller graph for this function:

ilUserPasswordEncoderFactory::setEncoders ( array  $encoders)
Parameters
ilPasswordEncoder[]$encoders
Exceptions
ilUserException

Definition at line 102 of file class.ilUserPasswordEncoderFactory.php.

{
$this->encoders = array();
foreach($encoders as $encoder)
{
if(!($encoder instanceof ilPasswordEncoder))
{
throw new ilUserException(sprintf('One of the passed encoders is not valid: %s.', json_encode($encoder)));
}
$this->encoders[$encoder->getName()] = $encoder;
}
}

Field Documentation

ilUserPasswordEncoderFactory::$default_encoder
protected

Definition at line 16 of file class.ilUserPasswordEncoderFactory.php.

Referenced by getDefaultEncoder(), and setDefaultEncoder().

ilUserPasswordEncoderFactory::$encoders = array()
protected

Definition at line 21 of file class.ilUserPasswordEncoderFactory.php.

Referenced by getEncoders().


The documentation for this class was generated from the following file: