yokai-php /
security-token-bundle
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Yokai\SecurityTokenBundle\Manager; |
||
| 4 | |||
| 5 | use DateTime; |
||
| 6 | use Yokai\SecurityTokenBundle\Entity\Token; |
||
| 7 | use Yokai\SecurityTokenBundle\Exception\TokenExpiredException; |
||
| 8 | use Yokai\SecurityTokenBundle\Exception\TokenNotFoundException; |
||
| 9 | use Yokai\SecurityTokenBundle\Exception\TokenUsedException; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @author Yann Eugoné <[email protected]> |
||
| 13 | */ |
||
| 14 | interface TokenManagerInterface |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @param string $purpose |
||
| 18 | * @param string $value |
||
| 19 | * |
||
| 20 | * @return Token |
||
| 21 | * |
||
| 22 | * @throws TokenNotFoundException if the token cannot be found |
||
| 23 | * @throws TokenExpiredException if the token is expired |
||
| 24 | * @throws TokenUsedException if the token is used |
||
| 25 | */ |
||
| 26 | public function get($purpose, $value); |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param string $purpose |
||
| 30 | * @param mixed $user |
||
| 31 | * @param array $payload |
||
| 32 | * |
||
| 33 | * @return Token |
||
| 34 | */ |
||
| 35 | public function create($purpose, $user, array $payload = []); |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @param Token $token |
||
| 39 | * @param DateTime|null $at |
||
| 40 | * |
||
| 41 | * @deprecated since version 2.2 and will be removed in 3.0 |
||
| 42 | */ |
||
| 43 | public function setUsed(Token $token, DateTime $at = null); |
||
|
0 ignored issues
–
show
|
|||
| 44 | |||
| 45 | /** |
||
| 46 | * @param Token $token |
||
| 47 | * @param DateTime|null $at |
||
| 48 | */ |
||
| 49 | public function consume(Token $token, DateTime $at = null); |
||
|
0 ignored issues
–
show
For interfaces and abstract methods it is generally a good practice to add a
@return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.
For interface and abstract methods, it is impossible to infer the return type
from the immediate code. In these cases, it is generally advisible to explicitly
annotate these methods with a Loading history...
|
|||
| 50 | |||
| 51 | /** |
||
| 52 | * @param Token $token |
||
| 53 | * |
||
| 54 | * @return mixed |
||
| 55 | */ |
||
| 56 | public function getUser(Token $token); |
||
| 57 | } |
||
| 58 |
For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a
@returndoc comment to communicate to implementors of these methods what they are expected to return.