Passed
Push — develop ( d0561f...3c99fb )
by Enea
03:29
created

RoleAuthorizerMiddleware   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 5
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 5
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A authorized() 0 3 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @author enea dhack <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Enea\Authorization\Middleware;
13
14
use Enea\Authorization\Contracts\GrantableOwner;
15
use Enea\Authorization\Contracts\RolesOwner;
16
17
class RoleAuthorizerMiddleware extends AuthorizerMiddleware
18
{
19 4
    protected function authorized(GrantableOwner $owner, array $grantables): bool
20
    {
21 4
        return $owner instanceof RolesOwner ? $this->authorizer->isAny($owner, $grantables) : false;
22
    }
23
}
24