From 5b79b40df9c9a057602c17f6dace2bc88d201b85 Mon Sep 17 00:00:00 2001 From: Andrew Millington Date: Fri, 29 Dec 2017 12:25:39 +0000 Subject: [PATCH 1/2] Fixed count placement to make code more efficient as per scrutinizer feedback --- examples/public/api.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/public/api.php b/examples/public/api.php index 3032ffed..2f896434 100644 --- a/examples/public/api.php +++ b/examples/public/api.php @@ -49,16 +49,18 @@ $app->get( ], ]; + $totalUsers = count($users); + // If the access token doesn't have the `basic` scope hide users' names if (in_array('basic', $request->getAttribute('oauth_scopes')) === false) { - for ($i = 0; $i < count($users); $i++) { + for ($i = 0; $i < $totalUsers; $i++) { unset($users[$i]['name']); } } // If the access token doesn't have the `email` scope hide users' email addresses if (in_array('email', $request->getAttribute('oauth_scopes')) === false) { - for ($i = 0; $i < count($users); $i++) { + for ($i = 0; $i < $totalUsers; $i++) { unset($users[$i]['email']); } } From ff29721ca94bfb9cd0f0b8ab2c3a05eb831e52b6 Mon Sep 17 00:00:00 2001 From: Andrew Millington Date: Fri, 29 Dec 2017 12:29:47 +0000 Subject: [PATCH 2/2] Removing call to setEncryptionKey as no such function on the authorization server --- examples/public/implicit.php | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/public/implicit.php b/examples/public/implicit.php index 73de09ec..73e46e46 100644 --- a/examples/public/implicit.php +++ b/examples/public/implicit.php @@ -41,7 +41,6 @@ $app = new App([ $privateKeyPath, 'lxZFUEsBCJ2Yb14IF2ygAHI5N4+ZAUXXaSeeJm6+twsUmIen' ); - $server->setEncryptionKey('lxZFUEsBCJ2Yb14IF2ygAHI5N4+ZAUXXaSeeJm6+twsUmIen'); // Enable the implicit grant on the server with a token TTL of 1 hour $server->enableGrantType(new ImplicitGrant(new \DateInterval('PT1H')));