FormatType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 205
Duplicated Lines 0 %

Test Coverage

Coverage 98.98%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 193
c 1
b 0
f 0
dl 0
loc 205
rs 10
ccs 97
cts 98
cp 0.9898

1 Method

Rating   Name   Duplication   Size   Complexity  
B getExtension() 0 103 2
1
<?php
2
/**
3
 * Created by Marcin.
4
 * Date: 03.03.2019
5
 * Time: 16:39
6
 */
7
8
namespace Mrcnpdlk\Api\Unoconv\Enum;
9
10
use Mrcnpdlk\Api\Unoconv\Exception\DomainException;
11
use MyCLabs\Enum\Enum;
12
13
/**
14
 * Class FormatType
15
 *
16
 * @method static BIB()
17
 * @method static DOC()
18
 * @method static DOC6()
19
 * @method static DOC95()
20
 * @method static DOCBOOK()
21
 * @method static DOCX()
22
 * @method static DOCX7()
23
 * @method static FODT()
24
 * @method static HTML()
25
 * @method static LATEX()
26
 * @method static MEDIAWIKI()
27
 * @method static ODT()
28
 * @method static OOXML()
29
 * @method static OTT()
30
 * @method static PDB()
31
 * @method static PDF()
32
 * @method static PSW()
33
 * @method static RTF()
34
 * @method static SDW()
35
 * @method static SDW4()
36
 * @method static SDW3()
37
 * @method static STW()
38
 * @method static SXW()
39
 * @method static TEXT()
40
 * @method static TXT()
41
 * @method static UOT()
42
 * @method static VOR()
43
 * @method static VOR4()
44
 * @method static VOR3()
45
 * @method static WPS()
46
 * @method static XHTML()
47
 * @method static BMP()
48
 * @method static EMF()
49
 * @method static EPS()
50
 * @method static FODG()
51
 * @method static GIF()
52
 * @method static JPG()
53
 * @method static MET()
54
 * @method static ODD()
55
 * @method static OTG()
56
 * @method static PBM()
57
 * @method static PCT()
58
 * @method static PGM()
59
 * @method static PNG()
60
 * @method static PPM()
61
 * @method static RAS()
62
 * @method static STD()
63
 * @method static SVG()
64
 * @method static SVM()
65
 * @method static SWF()
66
 * @method static SXD()
67
 * @method static SXD3()
68
 * @method static SXD5()
69
 * @method static TIFF()
70
 * @method static WMF()
71
 * @method static XPM()
72
 * @method static ODG()
73
 * @method static ODP()
74
 * @method static OTP()
75
 * @method static POTM()
76
 * @method static POT()
77
 * @method static PPTX()
78
 * @method static PPS()
79
 * @method static PPT()
80
 * @method static PWP()
81
 * @method static SDA()
82
 * @method static SDD()
83
 * @method static SDD3()
84
 * @method static SDD4()
85
 * @method static STI()
86
 * @method static SXI()
87
 * @method static UOP()
88
 * @method static VOR5()
89
 * @method static CSV()
90
 * @method static DBF()
91
 * @method static DIF()
92
 * @method static FODS()
93
 * @method static ODS()
94
 * @method static OTS()
95
 * @method static PXL()
96
 * @method static SDC()
97
 * @method static SDC4()
98
 * @method static SDC3()
99
 * @method static SLK()
100
 * @method static STC()
101
 * @method static SXC()
102
 * @method static UOS()
103
 * @method static XLS()
104
 * @method static XLS5()
105
 * @method static XLS95()
106
 * @method static XLT()
107
 * @method static XLT5()
108
 * @method static XLT95()
109
 * @method static XLSX()
110
 */
111
final class FormatType extends Enum
112
{
113
    public const BIB       = 'bib';
114
    public const DOC       = 'doc';
115
    public const DOC6      = 'doc6';
116
    public const DOC95     = 'doc95';
117
    public const DOCBOOK   = 'docbook';
118
    public const DOCX      = 'docx';
119
    public const DOCX7     = 'docx7';
120
    public const FODT      = 'fodt';
121
    public const HTML      = 'html';
122
    public const LATEX     = 'latex';
123
    public const MEDIAWIKI = 'mediawiki';
124
    public const ODT       = 'odt';
125
    public const OOXML     = 'ooxml';
126
    public const OTT       = 'ott';
127
    public const PDB       = 'pdb';
128
    public const PDF       = 'pdf';
129
    public const PSW       = 'psw';
130
    public const RTF       = 'rtf';
131
    public const SDW       = 'sdw';
132
    public const SDW4      = 'sdw4';
133
    public const SDW3      = 'sdw3';
134
    public const STW       = 'stw';
135
    public const SXW       = 'sxw';
136
    public const TEXT      = 'text';
137
    public const TXT       = 'txt';
138
    public const UOT       = 'uot';
139
    public const VOR       = 'vor';
140
    public const VOR4      = 'vor4';
141
    public const VOR3      = 'vor3';
142
    public const WPS       = 'wps';
143
    public const XHTML     = 'xhtml';
144
    public const BMP       = 'bmp';
145
    public const EMF       = 'emf';
146
    public const EPS       = 'eps';
147
    public const FODG      = 'fodg';
148
    public const GIF       = 'gif';
149
    public const JPG       = 'jpg';
150
    public const MET       = 'met';
151
    public const ODD       = 'odd';
152
    public const OTG       = 'otg';
153
    public const PBM       = 'pbm';
154
    public const PCT       = 'pct';
155
    public const PGM       = 'pgm';
156
    public const PNG       = 'png';
157
    public const PPM       = 'ppm';
158
    public const RAS       = 'ras';
159
    public const STD       = 'std';
160
    public const SVG       = 'svg';
161
    public const SVM       = 'svm';
162
    public const SWF       = 'swf';
163
    public const SXD       = 'sxd';
164
    public const SXD3      = 'sxd3';
165
    public const SXD5      = 'sxd5';
166
    public const TIFF      = 'tiff';
167
    public const WMF       = 'wmf';
168
    public const XPM       = 'xpm';
169
    public const ODG       = 'odg';
170
    public const ODP       = 'odp';
171
    public const OTP       = 'otp';
172
    public const POTM      = 'potm';
173
    public const POT       = 'pot';
174
    public const PPTX      = 'pptx';
175
    public const PPS       = 'pps';
176
    public const PPT       = 'ppt';
177
    public const PWP       = 'pwp';
178
    public const SDA       = 'sda';
179
    public const SDD       = 'sdd';
180
    public const SDD3      = 'sdd3';
181
    public const SDD4      = 'sdd4';
182
    public const STI       = 'sti';
183
    public const SXI       = 'sxi';
184
    public const UOP       = 'uop';
185
    public const VOR5      = 'vor5';
186
    public const CSV       = 'csv';
187
    public const DBF       = 'dbf';
188
    public const DIF       = 'dif';
189
    public const FODS      = 'fods';
190
    public const ODS       = 'ods';
191
    public const OTS       = 'ots';
192
    public const PXL       = 'pxl';
193
    public const SDC       = 'sdc';
194
    public const SDC4      = 'sdc4';
195
    public const SDC3      = 'sdc3';
196
    public const SLK       = 'slk';
197
    public const STC       = 'stc';
198
    public const SXC       = 'sxc';
199
    public const UOS       = 'uos';
200
    public const XLS       = 'xls';
201
    public const XLS5      = 'xls5';
202
    public const XLS95     = 'xls95';
203
    public const XLT       = 'xlt';
204
    public const XLT5      = 'xlt5';
205
    public const XLT95     = 'xlt95';
206
    public const XLSX      = 'xlsx';
207
208
    /**
209
     * @throws \Mrcnpdlk\Api\Unoconv\Exception\DomainException
210
     *
211
     * @return string
212
     */
213 3
    public function getExtension(): string
214
    {
215
        $tMap = [
216 3
            self::BIB       => 'bib',
217 3
            self::DOC       => 'doc',
218 3
            self::DOC6      => 'doc',
219 3
            self::DOC95     => 'doc',
220 3
            self::DOCBOOK   => 'xml',
221 3
            self::DOCX      => 'docx',
222 3
            self::DOCX7     => 'docx',
223 3
            self::FODT      => 'fodt',
224 3
            self::HTML      => 'html',
225 3
            self::LATEX     => 'ltx',
226 3
            self::MEDIAWIKI => 'txt',
227 3
            self::ODT       => 'odt',
228 3
            self::OOXML     => 'xml',
229 3
            self::OTT       => 'ott',
230 3
            self::PDB       => 'pdb',
231 3
            self::PDF       => 'pdf',
232 3
            self::PSW       => 'psw',
233 3
            self::RTF       => 'rtf',
234 3
            self::SDW       => 'sdw',
235 3
            self::SDW4      => 'sdw',
236 3
            self::SDW3      => 'sdw',
237 3
            self::STW       => 'stw',
238 3
            self::SXW       => 'sxw',
239 3
            self::TEXT      => 'txt',
240 3
            self::TXT       => 'txt',
241 3
            self::UOT       => 'uot',
242 3
            self::VOR       => 'vor',
243 3
            self::VOR4      => 'vor',
244 3
            self::VOR3      => 'vor',
245 3
            self::WPS       => 'wps',
246 3
            self::XHTML     => 'html',
247 3
            self::BMP       => 'bmp',
248 3
            self::EMF       => 'emf',
249 3
            self::EPS       => 'eps',
250 3
            self::FODG      => 'fodg',
251 3
            self::GIF       => 'gif',
252 3
            self::JPG       => 'jpg',
253 3
            self::MET       => 'met',
254 3
            self::ODD       => 'odd',
255 3
            self::OTG       => 'otg',
256 3
            self::PBM       => 'pbm',
257 3
            self::PCT       => 'pct',
258 3
            self::PGM       => 'pgm',
259 3
            self::PNG       => 'png',
260 3
            self::PPM       => 'ppm',
261 3
            self::RAS       => 'ras',
262 3
            self::STD       => 'std',
263 3
            self::SVG       => 'svg',
264 3
            self::SVM       => 'svm',
265 3
            self::SWF       => 'swf',
266 3
            self::SXD       => 'sxd',
267 3
            self::SXD3      => 'sxd',
268 3
            self::SXD5      => 'sxd',
269 3
            self::TIFF      => 'tiff',
270 3
            self::WMF       => 'wmf',
271 3
            self::XPM       => 'xpm',
272 3
            self::ODG       => 'odg',
273 3
            self::ODP       => 'odp',
274 3
            self::OTP       => 'otp',
275 3
            self::POTM      => 'potm',
276 3
            self::POT       => 'pot',
277 3
            self::PPTX      => 'pptx',
278 3
            self::PPS       => 'pps',
279 3
            self::PPT       => 'ppt',
280 3
            self::PWP       => 'pwp',
281 3
            self::SDA       => 'sda',
282 3
            self::SDD       => 'sdd',
283 3
            self::SDD3      => 'sdd',
284 3
            self::SDD4      => 'sdd',
285 3
            self::STI       => 'sti',
286 3
            self::SXI       => 'sxi',
287 3
            self::UOP       => 'uop',
288 3
            self::VOR5      => 'vor',
289 3
            self::CSV       => 'csv',
290 3
            self::DBF       => 'dbf',
291 3
            self::DIF       => 'dif',
292 3
            self::FODS      => 'fods',
293 3
            self::ODS       => 'ods',
294 3
            self::OTS       => 'ots',
295 3
            self::PXL       => 'pxl',
296 3
            self::SDC       => 'sdc',
297 3
            self::SDC4      => 'sdc',
298 3
            self::SDC3      => 'sdc',
299 3
            self::SLK       => 'slk',
300 3
            self::STC       => 'stc',
301 3
            self::SXC       => 'sxc',
302 3
            self::UOS       => 'uos',
303 3
            self::XLS       => 'xls',
304 3
            self::XLS5      => 'xls',
305 3
            self::XLS95     => 'xls',
306 3
            self::XLT       => 'xlt',
307 3
            self::XLT5      => 'xlt',
308 3
            self::XLT95     => 'xlt',
309 3
            self::XLSX      => 'xlsx',
310
        ];
311
312 3
        if (isset($tMap[$this->getValue()])) {
313 3
            return $tMap[$this->getValue()];
314
        }
315
        throw new DomainException(sprintf('Default extension form "%s" not defined', $this->getKey()));
0 ignored issues
show
Bug introduced by
It seems like $this->getKey() can also be of type false; however, parameter $args of sprintf() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

315
        throw new DomainException(sprintf('Default extension form "%s" not defined', /** @scrutinizer ignore-type */ $this->getKey()));
Loading history...
316
    }
317
}
318