Ip::setAuthorized()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4286
cc 1
eloc 3
nc 1
nop 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