Completed
Push — master ( a8cb62...764ba2 )
by François
03:52
created

Signature::setId()   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 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;
13
14
class Signature extends Resource
15
{
16
17
    /**
18
     * The unique id
19
     *
20
     * @var string
21
     */
22
    protected $id;
23
24
    /**
25
     * The HTTP headers (used to compute the signature)
26
     *
27
     * @var array
28
     */
29
    protected $headers;
30
31
    // /**
32
    //  * The Language Code (extract from Accept-Language)
33
    //  *
34
    //  * @var string
35
    //  */
36
    // protected $language;
37
38
    // /**
39
    //  * The Country Code (extract from Accept-Language)
40
    //  *
41
    //  * @var string
42
    //  */
43
    // protected $countryCode;
44
45
    public function getId()
46
    {
47
        return $this->id;
48
    }
49
50
    public function setId($id)
51
    {
52
        $this->id = $id;
53
    }
54
55
    public function setHeaders($headers)
56
    {
57
        $this->headers = $headers;
58
        $this->id = Fingerprint::generate($this->headers);
59
    }
60
61
    // public function getLanguage()
62
    // {
63
    //     return $this->language;
64
    // }
65
66
    // public function setLanguage($language)
67
    // {
68
    //     return $this->language = $language;
69
    // }
70
71
    // public function getCountryCode()
72
    // {
73
    //     return $this->countryCode;
74
    // }
75
76
    // public function setCountryCode($countryCode)
77
    // {
78
    //     return $this->countryCode = $countryCode;
79
    // }
80
81
    public function getLanguage()
82
    {
83
        return $this->getAttribute('language');
84
    }
85
86
    public function getCountryCode()
87
    {
88
        return $this->getAttribute('country_code');
89
    }
90
91
}
92