| 1 | <?php |
||
| 16 | class TokenFactory implements TokenFactoryInterface |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @var SecureRandomInterface |
||
| 20 | */ |
||
| 21 | private $secureRandom; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var DateInterval |
||
| 25 | */ |
||
| 26 | private $ttl; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var int |
||
| 30 | */ |
||
| 31 | private $length; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param SecureRandomInterface $secureRandom |
||
| 35 | * @param integer $ttl |
||
| 36 | * @param integer $length |
||
| 37 | */ |
||
| 38 | public function __construct(SecureRandomInterface $secureRandom, $ttl, $length = 32) |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @return TokenInterface |
||
| 47 | */ |
||
| 48 | public function createToken() |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @return string |
||
| 55 | */ |
||
| 56 | private function generateToken() |
||
| 60 | } |
||
| 61 |