Completed
Push — master ( 874d6a...5decb7 )
by Thibaud
10s
created

RecordCaption::getRawData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
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
use PhraseanetSDK\Annotation\ApiField as ApiField;
15
use PhraseanetSDK\Annotation\Id as Id;
16
17
class RecordCaption
18
{
19
20 1
    public static function fromList(array $values)
21
    {
22 1
        $captions = array();
23
24 1
        foreach ($values as $value) {
25 1
            $captions[$value->meta_structure_id] = self::fromValue($value);
26 1
        }
27
28 1
        return $captions;
29
    }
30
31 1
    public static function fromValue(\stdClass $value)
32
    {
33 1
        return new self($value);
34
    }
35
36
    /**
37
     * @var \stdClass
38
     */
39
    protected $source;
40
41
    /**
42
     * @param \stdClass $source
43
     */
44 1
    public function __construct(\stdClass $source)
45
    {
46 1
        $this->source = $source;
47 1
    }
48
49
    /**
50
     * @return \stdClass
51
     */
52
    public function getRawData()
53
    {
54
        return $this->source;
55
    }
56
57
    /**
58
     * @return \stdClass
59 1
     * @deprecated Use getRawData() instead
60
     */
61 1
    public function getSource()
62
    {
63
        return $this->source;
64
    }
65
66
    /**
67
     * Get the related databox meta field id
68
     *
69 1
     * @return integer
70
     */
71 1
    public function getMetaStructureId()
72
    {
73
        return $this->source->meta_structure_id;
74
    }
75
76
    /**
77
     * Get the name of the caption
78
     *
79 1
     * @return string
80
     */
81 1
    public function getName()
82
    {
83
        return $this->source->name;
84
    }
85
86
    /**
87
     * Get the value of the caption
88
     *
89
     * @return string
90
     */
91
    public function getValue()
92
    {
93
        return $this->source->value;
94
    }
95
}
96