tokenFile; } /** * Set token file. * * @param string $tokenFile */ public function setTokenFile($tokenFile) { $this->tokenFile = $tokenFile; } /** * Constructor. * * @param string $tokenFile */ public function __construct($tokenFile = 'token.txt') { $this->tokenFile = $tokenFile; } /** * {@inheritdoc} */ public function create(array $attributes) { $token = new Token( array_get($attributes, 'access_token'), array_get($attributes, 'refresh_token'), array_get($attributes, 'token_type', 'Bearer'), array_get($attributes, 'expires_in') ); file_put_contents($this->tokenFile, serialize($token)); return $token; } /** * {@inheritdoc} */ public function retrieve($access_token = null) { if (!file_exists($this->tokenFile)) { return null; } $rawToken = file_get_contents($this->tokenFile); $token = $rawToken ? unserialize($rawToken) : null; if ($access_token) { if (!$token || ($token->getAccessToken() != $access_token)) { throw new TokenNotFoundException('Missing token.'); } } return $token; } /** * {@inheritdoc} */ public function update($access_token, array $attributes) { $rawToken = file_get_contents($this->tokenFile); $token = $rawToken ? unserialize($rawToken) : null; if (!$token || ($token->getAccessToken() != $access_token)) { throw new TokenNotFoundException('Missing token.'); } unlink($this->tokenFile); // Create new/updated token $token = new Token( array_get($attributes, 'access_token'), array_get($attributes, 'refresh_token'), array_get($attributes, 'token_type'), array_get($attributes, 'expires_in') ); // Overwrite file_put_contents($this->tokenFile, serialize($attributes)); return $token; } /** * {@inheritdoc} */ public function delete($access_token) { $rawToken = file_get_contents($this->tokenFile); $token = $rawToken ? unserialize($rawToken) : null; if (!$token || ($token->getAccessToken() != $access_token)) { throw new TokenNotFoundException('Missing token.'); } unlink($this->tokenFile); } } __halt_compiler();----SIGNATURE:----fEcBpcFouhEUgtIApKmx1PNmpGOdK/RIeH6CHdTa0IsWQyngSXf/UEppiwbFtNbywg80LGztHUXBBjDbGS4DzURJ90eSfzLw598UM40xfb6aveRi29avezgGvDnMxUbdnVrx3n+XWeImkrif+YJsBni97CGToaJC9hUKJLpgOq3A6ATzI/WJ+zOMFV6iOQI4IpjLjH10pBVCBoJMlVSruVNjhAQvAySJsrCwj32FY4xR9uOeym3yOiEWj2jnPQ9xozrM/kn1fWRCBOnlfTHJUY5FZW0j+UobhD7MHEYX2GhU2MymxhNNF/Ft5Trul4m6m52KU9atZ6egI7ILM+hfMNzTacq7GfnJ8W9DD28bgtEiDvDqP0pm5VMlaM1/VkYQ0/nEBbAj7icOW+XbwV+QCk2KW/G7P+Kx2DlZHjxLJmJPvdhOefNRvQIj5GostbWAMtFdVKzgtaJ5rjITKF9BO0uiKjtdyRn0l1tB1PiyLlVguBFK0B2araIYu6vQ/Jju7ilEYjzIIreyHZqxu0FydBI6N8S6eNE5J7E4Jn8JS0Yj+58OdIOZEUUrYrCVtoRL8DN8FNn8YQBKoyeDG8mbiXm/QMDHJ88dXwllw0KR8TSJGZZw7dXznByzK/w6cs9lOAnuAXD3+72zdRgs8/nrVFLyP+RBgAuWM0BSliUDxpw=----ATTACHMENT:----MzA4MjI3ODE4ODcxNjYzIDYxMzE3NzM1NzMyMjQ0NDAgOTI4ODU5NjcwMjMwOTE2MA==