| 1 | <?php | ||
| 15 | class CallablePasswordGetter implements PasswordGetterInterface | ||
| 16 | { | ||
| 17 | /** | ||
| 18 | * @var callable | ||
| 19 | */ | ||
| 20 | private $callable; | ||
| 21 | |||
| 22 | /** | ||
| 23 | * Construct | ||
| 24 | * | ||
| 25 | * @param callable $callable | ||
| 26 | */ | ||
| 27 | 5 | public function __construct($callable) | |
| 28 |     { | ||
| 29 | 5 |         if (!is_callable($callable)) { | |
| 30 | 1 | throw new \InvalidArgumentException(sprintf( | |
| 31 | 1 | 'The first argument must be a callable, but "%s" given.', | |
| 32 | 1 | is_object($callable) ? get_class($callable) : gettype($callable) | |
| 33 | 1 | )); | |
| 34 | } | ||
| 35 | |||
| 36 | 4 | $this->callable = $callable; | |
| 37 | 4 | } | |
| 38 | |||
| 39 | /** | ||
| 40 |      * {@inheritDoc} | ||
| 41 | */ | ||
| 42 | 2 | public function getPassword($host, $user) | |
| 46 | } | ||
| 47 |