Code Duplication    Length = 5-6 lines in 3 locations

app/lib/FFCMS/Controllers/API/API.php 2 locations

@@ 339-343 (lines=5) @@
336
                return false;
337
            }
338
            // check token is not out-of-date
339
            if (time() > strtotime($tokensMapper->expires)) {
340
                $this->failure('authentication_error', "The token expired!", 401);
341
                $this->setOAuthError('invalid_grant');
342
343
                return false;
344
            }
345
            // if token found load the user for the token
346
            $usersModel->getUserByUUID($tokensMapper->users_uuid);
@@ 375-380 (lines=6) @@
372
        // get the scopes, this might have come from the token auth
373
        $scope = $f3->get('REQUEST.scope');
374
        $scopes = empty($scope) ? [] : preg_split("/[\s,]+/", $scope);
375
        if (null !== $tokensMapper->uuid && time() > strtotime($tokensMapper->expires)) {
376
            $this->failure('authentication_error', "The token expired!", 401);
377
            $this->setOAuthError('invalid_grant');
378
379
            return false;
380
        }
381
382
        $userAuthenticated = (is_array($user) || is_array($app));
383
        if (!$userAuthenticated) {

app/lib/FFCMS/Controllers/API/Token.php 1 location

@@ 94-98 (lines=5) @@
91
        }
92
93
        // code expired!
94
        if (time() > strtotime($tokensMapper->expires)) {
95
            $this->failure('authentication_error', "The token expired.", 401);
96
            $this->setOAuthError('invalid_grant');
97
            return;
98
        }
99
100
        // now set a token into the the same token object
101
        $tokensMapper->setUUID('token');