IpGranter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 13
ccs 3
cts 3
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A isGranted() 0 5 1
1
<?php
2
/**
3
 * This file is part of the sauls/security package.
4
 *
5
 * @author    Saulius Vaičeliūnas <[email protected]>
6
 * @link      http://saulius.vaiceliunas.lt
7
 * @copyright 2017
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Sauls\Bundle\Components\Component\Security\Access\Granter\Ip;
14
15
use Sauls\Bundle\Components\Component\Security\Access\Granter\BaseArrayGranter;
16
use Symfony\Component\HttpFoundation\IpUtils;
17
18
class IpGranter extends BaseArrayGranter implements IpGranterInterface
19
{
20
    /**
21
     * @param string $value
22
     * @param array  $values
23
     *
24
     * @return bool
25
     */
26 8
    public function isGranted(string $value, array $values = []): bool
27
    {
28 8
        $this->values = $this->mergeValues($values);
29
30 8
        return IpUtils::checkIp($value, $this->values);
31
    }
32
}
33