Translation::setCrowdinPath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Akeneo\Crowdin;
4
5
use \InvalidArgumentException;
6
7
/**
8
 * Simple Crowdin translation.
9
 *
10
 * @author Julien Janvier <[email protected]>
11
 */
12
class Translation
13
{
14
    /** @var string */
15
    protected $localPath;
16
17
    /** @var string */
18
    protected $crowdinPath;
19
20
    /** @var string */
21
    protected $title;
22
23
    /** @var string */
24
    protected $exportPattern;
25
26
    public function __construct($localPath, $crowdinPath)
27
    {
28
        $this->setLocalPath($localPath);
29
        $this->setCrowdinPath($crowdinPath);
30
    }
31
32
    /**
33
     * @param string $crowdinPath
34
     */
35
    public function setCrowdinPath($crowdinPath)
36
    {
37
        $this->crowdinPath = $crowdinPath;
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function getCrowdinPath()
44
    {
45
        return $this->crowdinPath;
46
    }
47
48
    /**
49
     * @param string $exportPattern
50
     */
51
    public function setExportPattern($exportPattern)
52
    {
53
        $this->exportPattern = $exportPattern;
54
    }
55
56
    /**
57
     * @return string
58
     */
59
    public function getExportPattern()
60
    {
61
        return $this->exportPattern;
62
    }
63
64
    /**
65
     * @param string $localPath
66
     *
67
     * @throws InvalidArgumentException
68
     */
69
    public function setLocalPath($localPath)
70
    {
71
        if (!file_exists($localPath)) {
72
            throw new InvalidArgumentException(sprintf('File %s does not exist', $localPath));
73
        }
74
75
        $this->localPath = $localPath;
76
    }
77
78
    /**
79
     * @return string
80
     */
81
    public function getLocalPath()
82
    {
83
        return $this->localPath;
84
    }
85
86
    /**
87
     * @param string $title
88
     */
89
    public function setTitle($title)
90
    {
91
        $this->title = $title;
92
    }
93
94
    /**
95
     * @return string
96
     */
97
    public function getTitle()
98
    {
99
        return $this->title;
100
    }
101
}
102