IpToUserMapper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getInternalUser() 0 4 2
1
<?php
2
3
namespace Kaliop\IdentityManagementBundle\Security\Helper;
4
5
use Kaliop\IdentityManagementBundle\Security\Interfaces\IpToUserMapper as MapperInterface;
6
7
/**
8
 * A very, very simplistic implementation of the interface
9
 */
10
class IpToUserMapper implements MapperInterface
11
{
12
    protected $ipList = array();
13
14
    /**
15
     * @param array $ipList key: ip, value: user id
16
     */
17
    public function __construct(array $ipList)
18
    {
19
        $this->ipList = $ipList;
20
    }
21
22
    public function getInternalUser($ip)
23
    {
24
        return isset($this->ipList[$ip]) ? $this->ipList[$ip] : false;
25
    }
26
}
27