4require_once
'Services/User/exceptions/class.ilUserException.php';
30 foreach(
$config as $key => $value)
32 switch(strtolower($key))
34 case 'default_password_encoder':
47 protected function initEncoders(array
$config)
49 $encoder_directory =
'Services/Password/classes/encoders';
50 foreach(
new DirectoryIterator($encoder_directory) as
$file)
60 require_once
$file->getPathname();
61 $class_name = preg_replace(
'/(class\.)(.*?)(\.php)/',
'$2',
$file->getBasename());
62 if(class_exists($class_name))
64 $reflection =
new ReflectionClass($class_name);
65 $encoder = $reflection->newInstanceArgs(array(
$config));
68 $this->encoders[$encoder->getName()] = $encoder;
104 $this->encoders = array();
109 throw new ilUserException(
sprintf(
'One of the passed encoders is not valid: %s.', json_encode($encoder)));
111 $this->encoders[$encoder->getName()] = $encoder;
131 if(!isset($this->encoders[$name]))
133 if(!$get_default_on_mismatch)
139 throw new ilUserException(
'No default encoder specified, fallback not possible.');
143 throw new ilUserException(
"No default encoder found for name: '{$this->getDefaultEncoder()}'.");
149 return $this->encoders[$name];
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
Class for user related exception handling in ILIAS.
getEncoderByName($name, $get_default_on_mismatch=false)
setEncoders(array $encoders)
setDefaultEncoder($default_encoder)
__construct(array $config=array())
getSupportedEncoderNames()
isSupportedByRuntime()
Returns whether or not the encoder is supported by the runtime (PHP, HHVM, ...)
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file