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

Signature::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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