Translation::getContent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * This file is part of the Amplexor\XConnect library
4
 *
5
 * @license http://opensource.org/licenses/MIT
6
 * @link https://github.com/amplexor-drupal/xconnect/
7
 * @version 1.0.0
8
 * @package Amplexor.XConnect
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Amplexor\XConnect\Response;
15
16
use Amplexor\XConnect\Response\File\FileInterface;
17
use Amplexor\XConnect\Response\InfoFile;
18
19
/**
20
 * Class representing a single translation within the response.
21
 */
22
class Translation
23
{
24
    /**
25
     * The response file.
26
     *
27
     * @var FileInterface
28
     */
29
    private $file;
30
31
    /**
32
     * The file information.
33
     *
34
     * @var InfoFile
35
     */
36
    private $info;
37
38
39
    /**
40
     * Construct a new translation by passing te response file and the filename.
41
     *
42
     * @param FileInterface $file
43
     *   The Response file object.
44
     * @param InfoFile $info
45
     *   The file info object.
46
     */
47 15
    public function __construct(FileInterface $file, InfoFile $info)
48
    {
49 15
        $this->file = $file;
50 15
        $this->info = $info;
51 15
    }
52
53
    /**
54
     * Get the file info.
55
     *
56
     * @return InfoFile
57
     */
58 6
    public function getInfo()
59
    {
60 6
        return $this->info;
61
    }
62
63
    /**
64
     * Get the translation content.
65
     *
66
     * @return string
67
     */
68 3
    public function getContent()
69
    {
70 3
        return $this->file->getContent(
71 3
            $this->info->getPath()
72 3
        );
73
    }
74
}
75