1 | <?php |
||
18 | class Config |
||
19 | { |
||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $binary = '/usr/bin/unoconv'; |
||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $host = 'localhost'; |
||
28 | /** |
||
29 | * Port to listen on (as listener) or to connect to (as client). |
||
30 | * |
||
31 | * @var int |
||
32 | */ |
||
33 | protected $port = 2002; |
||
34 | /** |
||
35 | * Specify the LibreOffice document type of the backend format. Possible document types are: document, graphics, presentation, |
||
36 | * spreadsheet. |
||
37 | * |
||
38 | * @var DocType |
||
39 | */ |
||
40 | protected $docType; |
||
41 | /** |
||
42 | * Specify the output format for the document. You can get a list of possible output formats per document type by using the --show |
||
43 | * option. |
||
44 | * |
||
45 | * @var FormatType |
||
46 | */ |
||
47 | protected $format; |
||
48 | /** |
||
49 | * When unoconv starts its own listener, try to connect to it for an amount of seconds before giving up. Increasing this may help when |
||
50 | * you receive random errors caused by the listener not being ready to accept conversion jobs. |
||
51 | * |
||
52 | * @var int |
||
53 | */ |
||
54 | protected $timeout = 30; |
||
55 | /** |
||
56 | * @var string |
||
57 | */ |
||
58 | protected $options = 'urp;StarOffice.ComponentContext'; |
||
59 | /** |
||
60 | * @var \Psr\Log\LoggerInterface |
||
61 | */ |
||
62 | protected $logger; |
||
63 | |||
64 | /** |
||
65 | * Config constructor. |
||
66 | * Default values; |
||
67 | * |
||
68 | * @param array $config |
||
69 | * |
||
70 | * @throws \Mrcnpdlk\Api\Unoconv\Exception\ConfigurationException |
||
71 | */ |
||
72 | 7 | public function __construct(array $config = []) |
|
89 | |||
90 | /** |
||
91 | * @return string |
||
92 | */ |
||
93 | 3 | public function getConnectionString(): string |
|
97 | |||
98 | /** |
||
99 | * @return DocType |
||
100 | */ |
||
101 | 4 | public function getDocType(): DocType |
|
105 | |||
106 | /** |
||
107 | * @return FormatType |
||
108 | */ |
||
109 | 4 | public function getFormat(): FormatType |
|
113 | |||
114 | /** |
||
115 | * @return \Psr\Log\LoggerInterface |
||
116 | */ |
||
117 | 3 | public function getLogger(): \Psr\Log\LoggerInterface |
|
118 | { |
||
119 | 3 | return $this->logger; |
|
120 | } |
||
121 | |||
122 | /** |
||
123 | * @return int |
||
124 | */ |
||
125 | 4 | public function getTimeout(): int |
|
129 | |||
130 | /** |
||
131 | * @param string $binary |
||
132 | * |
||
133 | * @return $this |
||
134 | */ |
||
135 | 3 | public function setBinary(string $binary): self |
|
141 | |||
142 | /** |
||
143 | * @param DocType $docType |
||
144 | * |
||
145 | * @return $this |
||
146 | */ |
||
147 | 1 | public function setDocType(DocType $docType): self |
|
153 | |||
154 | /** |
||
155 | * @param FormatType $format |
||
156 | * |
||
157 | * @return $this |
||
158 | */ |
||
159 | 1 | public function setFormat(FormatType $format): self |
|
165 | |||
166 | /** |
||
167 | * @param string $host |
||
168 | * |
||
169 | * @return $this |
||
170 | */ |
||
171 | 1 | public function setHost(string $host): self |
|
177 | |||
178 | /** |
||
179 | * @param \Psr\Log\LoggerInterface $logger |
||
180 | * |
||
181 | * @return $this |
||
182 | */ |
||
183 | public function setLogger(\Psr\Log\LoggerInterface $logger): self |
||
189 | |||
190 | /** |
||
191 | * @param int $port |
||
192 | * |
||
193 | * @return $this |
||
194 | */ |
||
195 | 1 | public function setPort(int $port): self |
|
201 | |||
202 | /** |
||
203 | * @param int $timeout |
||
204 | * |
||
205 | * @return $this |
||
206 | */ |
||
207 | 1 | public function setTimeout(int $timeout): self |
|
213 | } |
||
214 |