Failed Conditions
Push — master ( f0f3b5...42ea38 )
by Maximo
57s queued 10s
created

SubscriptionMiddleware   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A call() 0 12 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Canvas\Middleware;
6
7
use Phalcon\Mvc\Micro;
8
use Canvas\Http\Exception\UnauthorizedException;
9
use Canvas\Models\Subscription;
10
11
/**
12
 * Class AuthenticationMiddleware.
13
 *
14
 * @package Niden\Middleware
15
 */
16
class SubscriptionMiddleware extends TokenBase
17
{
18
    /**
19
     * Call me.
20
     *
21
     * @param Micro $api
22
     * @todo need to check section for auth here
23
     * @return bool
24
     */
25
    public function call(Micro $api)
0 ignored issues
show
Coding Style introduced by
function call() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
26
    {
27
        if ($api->getDI()->has('userData')) {
28
            $user = $api->getDI()->getUserData();
29
30
            if (!Subscription::getByDefaultCompany($user)->active()) {
31
                throw new UnauthorizedException('Subscription expired, Verify Payment');
32
            }
33
        }
34
35
        return true;
36
    }
37
}
38