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

Signature   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 78
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 78
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;
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