1 | <?php declare(strict_types=1); |
||
29 | class Auth implements AuthInterface |
||
30 | { |
||
31 | /** |
||
32 | * Tmdb object |
||
33 | * @var TmdbInterface |
||
34 | */ |
||
35 | private $tmdb = null; |
||
36 | /** |
||
37 | * Logger object |
||
38 | * @var \Psr\Log\LoggerInterface |
||
39 | */ |
||
40 | private $logger = null; |
||
41 | /** |
||
42 | * Request token |
||
43 | * @var string |
||
44 | */ |
||
45 | private $request_token = null; |
||
46 | /** |
||
47 | * Expiration date of request token |
||
48 | * @var \DateTime |
||
49 | */ |
||
50 | private $request_token_expiration = null; |
||
51 | /** |
||
52 | * Session Id |
||
53 | * @var string |
||
54 | */ |
||
55 | private $session_id = null; |
||
56 | |||
57 | /** |
||
58 | * Constructor |
||
59 | * @param TmdbInterface $tmdb |
||
60 | */ |
||
61 | 43 | public function __construct(TmdbInterface $tmdb) |
|
66 | |||
67 | /** |
||
68 | * Connect and valid request token |
||
69 | * @param string $request_token |
||
70 | * @param string|null $redirect_url Redirection url after connection (optional) |
||
71 | * @return bool |
||
72 | */ |
||
73 | 2 | public function connect(string $request_token, ?string $redirect_url = null) : bool |
|
85 | |||
86 | /** |
||
87 | * Get a new request token |
||
88 | * @return string |
||
89 | */ |
||
90 | 2 | public function getRequestToken() : string |
|
104 | |||
105 | /** |
||
106 | * Create a new session Auth |
||
107 | * @param string $request_token |
||
108 | * @return string |
||
109 | */ |
||
110 | 38 | public function createSession(string $request_token) : string |
|
120 | |||
121 | /** |
||
122 | * Magical getter |
||
123 | * @param string $name Name of the variable to get |
||
124 | * @return mixed Value of the variable getted |
||
125 | */ |
||
126 | 2 | public function __get(string $name) |
|
136 | } |
||
137 |