Completed
Push — master ( 40e49a...c75a1a )
by François
02:05
created

Signature   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A setId() 0 4 1
A setHeaders() 0 5 1
A getLanguage() 0 4 1
A getCountryCode() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Bouncer package.
5
 *
6
 * (c) François Hodierne <[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 Bouncer\Resource;
13
14
use Bouncer\Fingerprint;
15
use Bouncer\Resource;
16
17
class Signature extends Resource
18
{
19
20
    /**
21
     * The unique id
22
     *
23
     * @var string
24
     */
25
    protected $id;
26
27
    /**
28
     * The HTTP headers (used to compute the signature)
29
     *
30
     * @var array
31
     */
32
    protected $headers;
33
34
    public function getId()
35
    {
36
        return $this->id;
37
    }
38
39
    public function setId($id)
40
    {
41
        $this->id = $id;
42
    }
43
44
    public function setHeaders($headers)
45
    {
46
        $this->headers = $headers;
47
        $this->id = Fingerprint::generate($this->headers);
48
    }
49
50
    public function getLanguage()
51
    {
52
        return $this->getAttribute('language');
53
    }
54
55
    public function getCountryCode()
56
    {
57
        return $this->getAttribute('country_code');
58
    }
59
60
}
61