Completed
Push — master ( eb5568...bc1b58 )
by Nicolas
9s
created

Translation::setCrowdinPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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