[feature/passwords] Add get_name() method to drivers

This will allow us to actually properly differentiate between the available
drivers.

PHPBB3-11610
This commit is contained in:
Marc Alexander 2013-08-21 16:31:57 -05:00
parent df8e5f4c3c
commit 58755c4972
3 changed files with 36 additions and 0 deletions

View file

@ -3,6 +3,8 @@ services:
class: phpbb_crypto_driver_bcrypt class: phpbb_crypto_driver_bcrypt
arguments: arguments:
- @config - @config
calls:
- [set_name, [crypto.driver.bcrypt]]
tags: tags:
- { name: crypto.driver } - { name: crypto.driver }
@ -10,6 +12,8 @@ services:
class: phpbb_crypto_driver_bcrypt_2y class: phpbb_crypto_driver_bcrypt_2y
arguments: arguments:
- @config - @config
calls:
- [set_name, [crypto.driver.bcrypt_2y]]
tags: tags:
- { name: crypto.driver } - { name: crypto.driver }
@ -17,6 +21,8 @@ services:
class: phpbb_crypto_driver_salted_md5 class: phpbb_crypto_driver_salted_md5
arguments: arguments:
- @config - @config
calls:
- [set_name, [crypto.driver.salted_md5]]
tags: tags:
- { name: crypto.driver } - { name: crypto.driver }
@ -24,6 +30,8 @@ services:
class: phpbb_crypto_driver_phpass class: phpbb_crypto_driver_phpass
arguments: arguments:
- @config - @config
calls:
- [set_name, [crypto.driver.phpass]]
tags: tags:
- { name: crypto.driver } - { name: crypto.driver }

View file

@ -26,6 +26,9 @@ abstract class phpbb_crypto_driver_base implements phpbb_crypto_driver_interface
/** @var phpbb_crypto_driver_helper */ /** @var phpbb_crypto_driver_helper */
protected $helper; protected $helper;
/** @var driver name */
protected $name;
/** /**
* Constructor of crypto driver object * Constructor of crypto driver object
* *
@ -44,4 +47,22 @@ abstract class phpbb_crypto_driver_base implements phpbb_crypto_driver_interface
{ {
return true; return true;
} }
/**
* @inheritdoc
*/
public function get_name()
{
return $this->name;
}
/**
* Set driver name
*
* @param string $name Driver name
*/
public function set_name($name)
{
$this->name = $name;
}
} }

View file

@ -65,4 +65,11 @@ interface phpbb_crypto_driver_interface
* @return string String containing the hash settings * @return string String containing the hash settings
*/ */
public function get_settings_only($hash, $full = false); public function get_settings_only($hash, $full = false);
/**
* Get the driver name
*
* @return string Driver name
*/
public function get_name();
} }