Code Duplication    Length = 5-6 lines in 2 locations

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

@@ 236-240 (lines=5) @@
233
     */
234
    protected function password(\Base $f3)
235
    {
236
        if ('http' == $f3->get('SCHEME') && !empty($f3->get('api.https'))) {
237
            $this->failure('api_connection_failure', "Connection only allowed via HTTPS!", 400);
238
            $this->setOAuthError('unauthorized_client');
239
            return;
240
        }
241
242
        // fetch models now
243
        $db = \Registry::get('db');

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

@@ 333-338 (lines=6) @@
330
        $f3 = \Base::instance();
331
332
        // return if forcing access to https and not https
333
        if ('http' == $f3->get('SCHEME') && !empty($f3->get('api.https'))) {
334
            $this->failure('api_connection_error', "Connection only allowed via HTTPS!", 400);
335
            $this->setOAuthError('unauthorized_client');
336
337
            return false;
338
        }
339
340
        $oAuth2Model = Models\OAuth2::instance();
341
        $tokensMapper = $oAuth2Model->getTokensMapper();