pickles/src/OAuth2/ScopeStorage.php
Josh Sherman 11e4fee711 Switching the OAuth2 lib back again
Couldn't handle the fact that the errors were being echoed from the library
and not thrown or at the very least passed back so I could use them.
2014-10-19 10:26:15 -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'],
]);
}
}