mirror of
https://github.com/predis/predis.git
synced 2026-10-08 21:06:44 +00:00
Add a way to get the default value of an option from options.
It is not possible to get the default value of a client option using
either its name or instance:
$options = array(
'profile' => function ($options, $option) {
// instance of Predis\Option\OptionInterface
$profile = $options->getDefault($option);
// string representing an option handled by $options,
// returns NULL if the specified name is not handled.
$profile = $options->getDefault('profile');
return $profile;
},
);
This addition makes it less awkward to get the default value of an
option, especially when not in the context of a callable option
initializer.
This commit is contained in:
@@ -51,8 +51,8 @@ $parameters = array(
|
||||
);
|
||||
|
||||
$options = array(
|
||||
'profile' => function ($options) {
|
||||
$profile = ServerProfile::get('2.6');
|
||||
'profile' => function ($options, $option) {
|
||||
$profile = $options->getDefault($option);
|
||||
$profile->defineCommand('hmgetall', 'HashMultipleGetAll');
|
||||
|
||||
return $profile;
|
||||
|
||||
Reference in New Issue
Block a user