pickles/src/OAuth2/ScopeStorage.php
Josh Sherman dc06f37320 Updated the interfaces and dropped oauth version
Seems the oauth lib's stable version is 3.2, dropped down from the 4 version
to that.
2014-10-14 22:05:52 -04:00

26 lines
656 B
PHP

<?php
namespace Pickles\OAuth2;
use \League\OAuth2\Server\Storage\Adapter;
use \League\OAuth2\Server\Storage\ScopeInterface;
class ScopeStorage extends StorageAdapter implements ScopeInterface
{
public function get($scope, $grant_type = null, $client_id = null)
{
$sql = 'SELECT * FROM oauth_scopes WHERE id = ?;';
$results = $this->db->fetch($sql, [$scope]);
if (count($results) === 0)
{
return null;
}
return (new ScopeEntity($this->server))->hydrate([
'id' => $result[0]['id'],
'description' => $result[0]['description'],
]);
}
}