Completed
Push — 8.x ( 41ca52 )
by Tim
10:18
created

CsvTrait::getFromCharset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * TechDivision\Import\Configuration\Jms\Configuration\CsvTrait
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2016 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/techdivision/import-configuration-jms
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Configuration\Jms\Configuration;
22
23
use JMS\Serializer\Annotation\Type;
24
use JMS\Serializer\Annotation\SerializedName;
25
26
/**
27
 * A trait implementation that provides CSV configuration handling.
28
 *
29
 * @author    Tim Wagner <[email protected]>
30
 * @copyright 2016 TechDivision GmbH <[email protected]>
31
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
32
 * @link      https://github.com/techdivision/import-configuration-jms
33
 * @link      http://www.techdivision.com
34
 */
35
trait CsvTrait
36
{
37
38
    /**
39
     * The subject's delimiter character for CSV files.
40
     *
41
     * @var string
42
     * @Type("string")
43
     */
44
    protected $delimiter = ',';
45
46
    /**
47
     * The subject's enclosure character for CSV files.
48
     *
49
     * @var string
50
     * @Type("string")
51
     */
52
    protected $enclosure = '"';
53
54
    /**
55
     * The subject's escape character for CSV files.
56
     *
57
     * @var string
58
     * @Type("string")
59
     */
60
    protected $escape = '\\';
61
62
    /**
63
     * The subject's source charset for the CSV file.
64
     *
65
     * @var string
66
     * @Type("string")
67
     * @SerializedName("from-charset")
68
     */
69
    protected $fromCharset;
70
71
    /**
72
     * The subject's target charset for a CSV file.
73
     *
74
     * @var string
75
     * @Type("string")
76
     * @SerializedName("to-charset")
77
     */
78
    protected $toCharset;
79
80
    /**
81
     * The subject's file mode for a CSV target file.
82
     *
83
     * @var string
84
     * @Type("string")
85
     * @SerializedName("file-mode")
86
     */
87
    protected $fileMode;
88
89
    /**
90
     * Return's the delimiter character to use, default value is comma (,).
91
     *
92
     * @return string The delimiter character
93
     */
94
    public function getDelimiter()
95
    {
96
        return $this->delimiter;
97
    }
98
99
    /**
100
     * The enclosure character to use, default value is double quotation (").
101
     *
102
     * @return string The enclosure character
103
     */
104
    public function getEnclosure()
105
    {
106
        return $this->enclosure;
107
    }
108
109
    /**
110
     * The escape character to use, default value is backslash (\).
111
     *
112
     * @return string The escape character
113
     */
114
    public function getEscape()
115
    {
116
        return $this->escape;
117
    }
118
119
    /**
120
     * The file encoding of the CSV source file, default value is UTF-8.
121
     *
122
     * @return string The charset used by the CSV source file
123
     */
124
    public function getFromCharset()
125
    {
126
        return $this->fromCharset;
127
    }
128
129
    /**
130
     * The file encoding of the CSV targetfile, default value is UTF-8.
131
     *
132
     * @return string The charset used by the CSV target file
133
     */
134
    public function getToCharset()
135
    {
136
        return $this->toCharset;
137
    }
138
139
    /**
140
     * The file mode of the CSV target file, either one of write or append, default is write.
141
     *
142
     * @return string The file mode of the CSV target file
143
     */
144
    public function getFileMode()
145
    {
146
        return $this->fileMode;
147
    }
148
}
149