Fixed example API hasScope reference

This commit is contained in:
Malachi Soord 2014-12-05 18:12:19 +01:00
parent edaccab04b
commit c8983b35a0

View File

@ -59,11 +59,11 @@ $router->get('/users', function (Request $request) use ($server) {
'name' => $result['name'], 'name' => $result['name'],
]; ];
if ($server->hasScope('email')) { if ($server->getAccessToken()->hasScope('email')) {
$user['email'] = $result['email']; $user['email'] = $result['email'];
} }
if ($server->hasScope('photo')) { if ($server->getAccessToken()->hasScope('photo')) {
$user['photo'] = $result['photo']; $user['photo'] = $result['photo'];
} }
@ -87,11 +87,11 @@ $router->get('/users/{username}', function (Request $request, $args) use ($serve
'name' => $result[0]['name'], 'name' => $result[0]['name'],
]; ];
if ($server->hasScope('email')) { if ($server->getAccessToken()->hasScope('email')) {
$user['email'] = $result[0]['email']; $user['email'] = $result[0]['email'];
} }
if ($server->hasScope('photo')) { if ($server->getAccessToken()->hasScope('photo')) {
$user['photo'] = $result[0]['photo']; $user['photo'] = $result[0]['photo'];
} }