Ip   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 6
c 2
b 1
f 0
lcom 1
cbo 1
dl 0
loc 42
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getIp() 0 4 1
A setIp() 0 6 1
A getEnvironment() 0 4 1
A setEnvironment() 0 6 1
A isAuthorized() 0 4 1
A setAuthorized() 0 6 1
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2015 Spomky-Labs
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license.  See the LICENSE file for details.
10
 */
11
12
namespace SpomkyLabs\IpFilterBundle\Model;
13
14
use SpomkyLabs\IpFilterBundle\Tool\IpConverter;
15
16
class Ip implements IpInterface
17
{
18
    protected $ip;
19
    protected $environment = [];
20
    protected $authorized;
21
22
    public function getIp()
23
    {
24
        return IpConverter::fromHexToIp($this->ip);
25
    }
26
27
    public function setIp($ip)
28
    {
29
        $this->ip = IpConverter::fromIpToHex($ip);
30
31
        return $this;
32
    }
33
34
    public function getEnvironment()
35
    {
36
        return $this->environment;
37
    }
38
39
    public function setEnvironment(array $environment)
40
    {
41
        $this->environment = $environment;
42
43
        return $this;
44
    }
45
46
    public function isAuthorized()
47
    {
48
        return $this->authorized;
49
    }
50
51
    public function setAuthorized($authorized)
52
    {
53
        $this->authorized = $authorized;
54
55
        return $this;
56
    }
57
}
58