1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Bukashk0zzzYmlGenerator |
5
|
|
|
* |
6
|
|
|
* (c) Denis Golubovskiy <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Bukashk0zzz\YmlGenerator; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Class Settings |
16
|
|
|
*/ |
17
|
|
|
class Settings |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* Xml file encoding |
21
|
|
|
* |
22
|
|
|
* @var string |
23
|
|
|
*/ |
24
|
|
|
protected $encoding = 'windows-1251'; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Output file name. If null 'php://output' is used. |
28
|
|
|
* |
29
|
|
|
* @var string|null |
30
|
|
|
*/ |
31
|
|
|
protected $outputFile; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* If true Generator will return generated YML string. |
35
|
|
|
* Not recommended to use this for big catalogs because of heavy memory usage. |
36
|
|
|
* |
37
|
|
|
* @var bool |
38
|
|
|
*/ |
39
|
|
|
protected $returnResultYMLString = false; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Indent string in xml file. False or null means no indent; |
43
|
|
|
* |
44
|
|
|
* @var string |
45
|
|
|
*/ |
46
|
|
|
protected $indentString = "\t"; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @return string |
50
|
|
|
*/ |
51
|
|
|
public function getEncoding() |
52
|
|
|
{ |
53
|
|
|
return $this->encoding; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @param string $encoding |
58
|
|
|
* |
59
|
|
|
* @return Settings |
60
|
|
|
*/ |
61
|
|
|
public function setEncoding($encoding) |
62
|
|
|
{ |
63
|
|
|
$this->encoding = $encoding; |
64
|
|
|
|
65
|
|
|
return $this; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return string|null |
70
|
|
|
*/ |
71
|
|
|
public function getOutputFile() |
72
|
|
|
{ |
73
|
|
|
return $this->outputFile; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @param string|null $outputFile |
78
|
|
|
* |
79
|
|
|
* @return Settings |
80
|
|
|
*/ |
81
|
|
|
public function setOutputFile($outputFile) |
82
|
|
|
{ |
83
|
|
|
$this->outputFile = $outputFile; |
84
|
|
|
|
85
|
|
|
return $this; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return string |
90
|
|
|
*/ |
91
|
|
|
public function getIndentString() |
92
|
|
|
{ |
93
|
|
|
return $this->indentString; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @param string $indentString |
98
|
|
|
* |
99
|
|
|
* @return Settings |
100
|
|
|
*/ |
101
|
|
|
public function setIndentString($indentString) |
102
|
|
|
{ |
103
|
|
|
$this->indentString = $indentString; |
104
|
|
|
|
105
|
|
|
return $this; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @param bool $returnResultYMLString |
110
|
|
|
* |
111
|
|
|
* @return Settings |
112
|
|
|
*/ |
113
|
|
|
public function setReturnResultYMLString($returnResultYMLString) |
114
|
|
|
{ |
115
|
|
|
$this->returnResultYMLString = $returnResultYMLString; |
116
|
|
|
|
117
|
|
|
return $this; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return bool |
122
|
|
|
*/ |
123
|
|
|
public function getReturnResultYMLString() |
124
|
|
|
{ |
125
|
|
|
return $this->returnResultYMLString; |
126
|
|
|
} |
127
|
|
|
} |
128
|
|
|
|