Completed
Push — master ( 5decb7...aee104 )
by Thibaud
14:37 queued 11:26
created

DataboxTermsOfUse::getLocale()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * This file is part of Phraseanet SDK.
5
 *
6
 * (c) Alchemy <[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 PhraseanetSDK\Entity;
13
14
class DataboxTermsOfUse
15
{
16
17 1
    public static function fromList(array $values)
18
    {
19 1
        $terms = array();
20
21 1
        foreach ($values as $value) {
22 1
            $terms[$value->locale] = self::fromValue($value);
23 1
        }
24
25 1
        return $terms;
26
    }
27
28 1
    public static function fromValue(\stdClass $value)
29
    {
30 1
        return new self($value);
31
    }
32
33
    /**
34
     * @var \stdClass
35
     */
36
    protected $source;
37
38
    /**
39
     * @param \stdClass $source
40
     */
41 1
    public function __construct(\stdClass $source)
42
    {
43 1
        $this->source = $source;
44 1
    }
45
46
    /**
47
     * @return \stdClass
48
     */
49
    public function getRawData()
50
    {
51
        return $this->source;
52
    }
53
54
    /**
55
     * @return string
56
     */
57 1
    public function getLocale()
58
    {
59 1
        return $this->source->locale;
60
    }
61
62
    /**
63
     * @return string
64
     */
65 1
    public function getTerms()
66
    {
67 1
        return $this->source->terms;
68
    }
69
}
70