Completed
Pull Request — master (#151)
by Alexander
04:33
created

DictionaryExample::getTranslations()   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 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
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
 * Yandex PHP Library
4
 *
5
 * @copyright NIX Solutions Ltd.
6
 * @link https://github.com/nixsolutions/yandex-php-library
7
 */
8
9
/**
10
 * @namespace
11
 */
12
namespace Yandex\Dictionary;
13
14
/**
15
 * Class DictionaryExample
16
 *
17
 * @category Yandex
18
 * @package  Dictionary
19
 *
20
 * @author   Nikolay Oleynikov <[email protected]>
21
 * @created  07.11.14 20:21
22
 */
23
class DictionaryExample extends DictionaryBaseItem
24
{
25
    /**
26
     * @var
27
     */
28
    protected $translations = [];
29
30
    /**
31
     *
32
     */
33 1
    public function __construct($example)
34
    {
35 1
        parent::__construct($example);
36
37 1
        if (isset($example->tr)) {
38 1
            foreach ($example->tr as $translation) {
39 1
                $this->translations[] = $translation->text;
40 1
            }
41 1
        }
42 1
    }
43
44
    /**
45
     *  @return array
46
     */
47 1
    public function getTranslations()
48
    {
49 1
        return $this->translations;
50
    }
51
}
52