PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 3.14.2
GiveWP – Donation Plugin and Fundraising Platform v3.14.2
4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 2.32.0 2.33.0 2.33.1 2.33.2 2.33.3 2.33.4 2.33.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.10.0 3.11.0 3.12.0 3.12.1 3.12.2 3.12.3 3.13.0 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.17.0 3.17.1 3.17.2 3.18.0 3.19.0 3.19.1 3.19.2 3.19.3 3.19.4 3.2.0 3.2.1 3.2.2 3.20.0 3.21.0 3.21.1 3.22.0 3.22.1 3.22.2 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.7.0 3.8.0 3.9.0 4.0.0 4.1.0 4.1.1 4.10.0 4.10.1 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.14.5 4.14.6 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.1 4.7.0 4.7.1 4.8.0 4.8.1 4.9.0 trunk 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.2 2.11.3 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.13.1 2.13.2 2.13.3 2.13.4 2.14.0 2.15.0 2.16.0 2.16.1 2.17.0 2.17.1 2.17.3 2.18.0 2.18.1 2.19.1 2.19.2 2.19.3 2.19.4 2.19.5 2.19.6 2.19.7 2.19.8 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.20.0 2.20.1 2.20.2 2.21.0 2.21.1 2.21.2 2.21.3 2.21.4 2.22.0 2.22.1 2.22.2 2.22.3 2.23.0 2.23.1 2.23.2 2.24.0 2.24.1 2.24.2 2.25.0 2.25.1 2.25.2 2.25.3 2.26.0 2.27.0 2.27.1 2.27.2 2.27.3 2.28.0 2.29.0 2.29.1 2.29.2
give / vendor / vendor-prefixed / fakerphp / faker / src / Faker / Provider / File.php
give / vendor / vendor-prefixed / fakerphp / faker / src / Faker / Provider Last commit date
ar_EG 1 year ago ar_JO 1 year ago ar_SA 1 year ago at_AT 1 year ago bg_BG 1 year ago bn_BD 1 year ago cs_CZ 1 year ago da_DK 1 year ago de_AT 1 year ago de_CH 1 year ago de_DE 1 year ago el_CY 1 year ago el_GR 1 year ago en_AU 1 year ago en_CA 1 year ago en_GB 1 year ago en_HK 1 year ago en_IN 1 year ago en_NG 1 year ago en_NZ 1 year ago en_PH 1 year ago en_SG 1 year ago en_UG 1 year ago en_US 1 year ago en_ZA 1 year ago es_AR 1 year ago es_ES 1 year ago es_PE 1 year ago es_VE 1 year ago et_EE 1 year ago fa_IR 1 year ago fi_FI 1 year ago fr_BE 1 year ago fr_CA 1 year ago fr_CH 1 year ago fr_FR 1 year ago he_IL 1 year ago hr_HR 1 year ago hu_HU 1 year ago hy_AM 1 year ago id_ID 1 year ago is_IS 1 year ago it_CH 1 year ago it_IT 1 year ago ja_JP 1 year ago ka_GE 1 year ago kk_KZ 1 year ago ko_KR 1 year ago lt_LT 1 year ago lv_LV 1 year ago me_ME 1 year ago mn_MN 1 year ago ms_MY 1 year ago nb_NO 1 year ago ne_NP 1 year ago nl_BE 1 year ago nl_NL 1 year ago pl_PL 1 year ago pt_BR 1 year ago pt_PT 1 year ago ro_MD 1 year ago ro_RO 1 year ago ru_RU 1 year ago sk_SK 1 year ago sl_SI 1 year ago sr_Cyrl_RS 1 year ago sr_Latn_RS 1 year ago sr_RS 1 year ago sv_SE 1 year ago th_TH 1 year ago tr_TR 1 year ago uk_UA 1 year ago vi_VN 1 year ago zh_CN 1 year ago zh_TW 1 year ago Address.php 1 year ago Barcode.php 1 year ago Base.php 1 year ago Biased.php 1 year ago Color.php 1 year ago Company.php 1 year ago DateTime.php 1 year ago File.php 1 year ago HtmlLorem.php 1 year ago Image.php 1 year ago Internet.php 1 year ago Lorem.php 1 year ago Medical.php 1 year ago Miscellaneous.php 1 year ago Payment.php 1 year ago Person.php 1 year ago PhoneNumber.php 1 year ago Text.php 1 year ago UserAgent.php 1 year ago Uuid.php 1 year ago
File.php
617 lines
1 <?php
2 /**
3 * @license MIT
4 *
5 * Modified by impress-org on 07-August-2024 using Strauss.
6 * @see https://github.com/BrianHenryIE/strauss
7 */
8
9 namespace Give\Vendors\Faker\Provider;
10
11 class File extends Base
12 {
13 /**
14 * MIME types from the apache.org file. Some types are truncated.
15 *
16 * @var array Map of MIME types => file extension(s)
17 *
18 * @see http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
19 */
20 protected static $mimeTypes = [
21 'application/atom+xml' => 'atom',
22 'application/ecmascript' => 'ecma',
23 'application/emma+xml' => 'emma',
24 'application/epub+zip' => 'epub',
25 'application/java-archive' => 'jar',
26 'application/java-vm' => 'class',
27 'application/javascript' => 'js',
28 'application/json' => 'json',
29 'application/jsonml+json' => 'jsonml',
30 'application/lost+xml' => 'lostxml',
31 'application/mathml+xml' => 'mathml',
32 'application/mets+xml' => 'mets',
33 'application/mods+xml' => 'mods',
34 'application/mp4' => 'mp4s',
35 'application/msword' => ['doc', 'dot'],
36 'application/octet-stream' => [
37 'bin',
38 'dms',
39 'lrf',
40 'mar',
41 'so',
42 'dist',
43 'distz',
44 'pkg',
45 'bpk',
46 'dump',
47 'elc',
48 'deploy',
49 ],
50 'application/ogg' => 'ogx',
51 'application/omdoc+xml' => 'omdoc',
52 'application/pdf' => 'pdf',
53 'application/pgp-encrypted' => 'pgp',
54 'application/pgp-signature' => ['asc', 'sig'],
55 'application/pkix-pkipath' => 'pkipath',
56 'application/pkixcmp' => 'pki',
57 'application/pls+xml' => 'pls',
58 'application/postscript' => ['ai', 'eps', 'ps'],
59 'application/pskc+xml' => 'pskcxml',
60 'application/rdf+xml' => 'rdf',
61 'application/reginfo+xml' => 'rif',
62 'application/rss+xml' => 'rss',
63 'application/rtf' => 'rtf',
64 'application/sbml+xml' => 'sbml',
65 'application/vnd.adobe.air-application-installer-package+zip' => 'air',
66 'application/vnd.adobe.xdp+xml' => 'xdp',
67 'application/vnd.adobe.xfdf' => 'xfdf',
68 'application/vnd.ahead.space' => 'ahead',
69 'application/vnd.dart' => 'dart',
70 'application/vnd.data-vision.rdz' => 'rdz',
71 'application/vnd.dece.data' => ['uvf', 'uvvf', 'uvd', 'uvvd'],
72 'application/vnd.dece.ttml+xml' => ['uvt', 'uvvt'],
73 'application/vnd.dece.unspecified' => ['uvx', 'uvvx'],
74 'application/vnd.dece.zip' => ['uvz', 'uvvz'],
75 'application/vnd.denovo.fcselayout-link' => 'fe_launch',
76 'application/vnd.dna' => 'dna',
77 'application/vnd.dolby.mlp' => 'mlp',
78 'application/vnd.dpgraph' => 'dpg',
79 'application/vnd.dreamfactory' => 'dfac',
80 'application/vnd.ds-keypoint' => 'kpxx',
81 'application/vnd.dvb.ait' => 'ait',
82 'application/vnd.dvb.service' => 'svc',
83 'application/vnd.dynageo' => 'geo',
84 'application/vnd.ecowin.chart' => 'mag',
85 'application/vnd.enliven' => 'nml',
86 'application/vnd.epson.esf' => 'esf',
87 'application/vnd.epson.msf' => 'msf',
88 'application/vnd.epson.quickanime' => 'qam',
89 'application/vnd.epson.salt' => 'slt',
90 'application/vnd.epson.ssf' => 'ssf',
91 'application/vnd.ezpix-album' => 'ez2',
92 'application/vnd.ezpix-package' => 'ez3',
93 'application/vnd.fdf' => 'fdf',
94 'application/vnd.fdsn.mseed' => 'mseed',
95 'application/vnd.fdsn.seed' => ['seed', 'dataless'],
96 'application/vnd.flographit' => 'gph',
97 'application/vnd.fluxtime.clip' => 'ftc',
98 'application/vnd.hal+xml' => 'hal',
99 'application/vnd.hydrostatix.sof-data' => 'sfd-hdstx',
100 'application/vnd.ibm.minipay' => 'mpy',
101 'application/vnd.ibm.secure-container' => 'sc',
102 'application/vnd.iccprofile' => ['icc', 'icm'],
103 'application/vnd.igloader' => 'igl',
104 'application/vnd.immervision-ivp' => 'ivp',
105 'application/vnd.kde.karbon' => 'karbon',
106 'application/vnd.kde.kchart' => 'chrt',
107 'application/vnd.kde.kformula' => 'kfo',
108 'application/vnd.kde.kivio' => 'flw',
109 'application/vnd.kde.kontour' => 'kon',
110 'application/vnd.kde.kpresenter' => ['kpr', 'kpt'],
111 'application/vnd.kde.kspread' => 'ksp',
112 'application/vnd.kde.kword' => ['kwd', 'kwt'],
113 'application/vnd.kenameaapp' => 'htke',
114 'application/vnd.kidspiration' => 'kia',
115 'application/vnd.kinar' => ['kne', 'knp'],
116 'application/vnd.koan' => ['skp', 'skd', 'skt', 'skm'],
117 'application/vnd.kodak-descriptor' => 'sse',
118 'application/vnd.las.las+xml' => 'lasxml',
119 'application/vnd.llamagraphics.life-balance.desktop' => 'lbd',
120 'application/vnd.llamagraphics.life-balance.exchange+xml' => 'lbe',
121 'application/vnd.lotus-1-2-3' => '123',
122 'application/vnd.lotus-approach' => 'apr',
123 'application/vnd.lotus-freelance' => 'pre',
124 'application/vnd.lotus-notes' => 'nsf',
125 'application/vnd.lotus-organizer' => 'org',
126 'application/vnd.lotus-screencam' => 'scm',
127 'application/vnd.mozilla.xul+xml' => 'xul',
128 'application/vnd.ms-artgalry' => 'cil',
129 'application/vnd.ms-cab-compressed' => 'cab',
130 'application/vnd.ms-excel' => [
131 'xls',
132 'xlm',
133 'xla',
134 'xlc',
135 'xlt',
136 'xlw',
137 ],
138 'application/vnd.ms-excel.addin.macroenabled.12' => 'xlam',
139 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => 'xlsb',
140 'application/vnd.ms-excel.sheet.macroenabled.12' => 'xlsm',
141 'application/vnd.ms-excel.template.macroenabled.12' => 'xltm',
142 'application/vnd.ms-fontobject' => 'eot',
143 'application/vnd.ms-htmlhelp' => 'chm',
144 'application/vnd.ms-ims' => 'ims',
145 'application/vnd.ms-lrm' => 'lrm',
146 'application/vnd.ms-officetheme' => 'thmx',
147 'application/vnd.ms-pki.seccat' => 'cat',
148 'application/vnd.ms-pki.stl' => 'stl',
149 'application/vnd.ms-powerpoint' => ['ppt', 'pps', 'pot'],
150 'application/vnd.ms-powerpoint.addin.macroenabled.12' => 'ppam',
151 'application/vnd.ms-powerpoint.presentation.macroenabled.12' => 'pptm',
152 'application/vnd.ms-powerpoint.slide.macroenabled.12' => 'sldm',
153 'application/vnd.ms-powerpoint.slideshow.macroenabled.12' => 'ppsm',
154 'application/vnd.ms-powerpoint.template.macroenabled.12' => 'potm',
155 'application/vnd.ms-project' => ['mpp', 'mpt'],
156 'application/vnd.ms-word.document.macroenabled.12' => 'docm',
157 'application/vnd.ms-word.template.macroenabled.12' => 'dotm',
158 'application/vnd.ms-works' => ['wps', 'wks', 'wcm', 'wdb'],
159 'application/vnd.ms-wpl' => 'wpl',
160 'application/vnd.ms-xpsdocument' => 'xps',
161 'application/vnd.mseq' => 'mseq',
162 'application/vnd.musician' => 'mus',
163 'application/vnd.oasis.opendocument.chart' => 'odc',
164 'application/vnd.oasis.opendocument.chart-template' => 'otc',
165 'application/vnd.oasis.opendocument.database' => 'odb',
166 'application/vnd.oasis.opendocument.formula' => 'odf',
167 'application/vnd.oasis.opendocument.formula-template' => 'odft',
168 'application/vnd.oasis.opendocument.graphics' => 'odg',
169 'application/vnd.oasis.opendocument.graphics-template' => 'otg',
170 'application/vnd.oasis.opendocument.image' => 'odi',
171 'application/vnd.oasis.opendocument.image-template' => 'oti',
172 'application/vnd.oasis.opendocument.presentation' => 'odp',
173 'application/vnd.oasis.opendocument.presentation-template' => 'otp',
174 'application/vnd.oasis.opendocument.spreadsheet' => 'ods',
175 'application/vnd.oasis.opendocument.spreadsheet-template' => 'ots',
176 'application/vnd.oasis.opendocument.text' => 'odt',
177 'application/vnd.oasis.opendocument.text-master' => 'odm',
178 'application/vnd.oasis.opendocument.text-template' => 'ott',
179 'application/vnd.oasis.opendocument.text-web' => 'oth',
180 'application/vnd.olpc-sugar' => 'xo',
181 'application/vnd.oma.dd2+xml' => 'dd2',
182 'application/vnd.openofficeorg.extension' => 'oxt',
183 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx',
184 'application/vnd.openxmlformats-officedocument.presentationml.slide' => 'sldx',
185 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'ppsx',
186 'application/vnd.openxmlformats-officedocument.presentationml.template' => 'potx',
187 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx',
188 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'xltx',
189 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx',
190 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'dotx',
191 'application/vnd.pvi.ptid1' => 'ptid',
192 'application/vnd.quark.quarkxpress' => [
193 'qxd',
194 'qxt',
195 'qwd',
196 'qwt',
197 'qxl',
198 'qxb',
199 ],
200 'application/vnd.realvnc.bed' => 'bed',
201 'application/vnd.recordare.musicxml' => 'mxl',
202 'application/vnd.recordare.musicxml+xml' => 'musicxml',
203 'application/vnd.rig.cryptonote' => 'cryptonote',
204 'application/vnd.rim.cod' => 'cod',
205 'application/vnd.rn-realmedia' => 'rm',
206 'application/vnd.rn-realmedia-vbr' => 'rmvb',
207 'application/vnd.route66.link66+xml' => 'link66',
208 'application/vnd.sailingtracker.track' => 'st',
209 'application/vnd.seemail' => 'see',
210 'application/vnd.sema' => 'sema',
211 'application/vnd.semd' => 'semd',
212 'application/vnd.semf' => 'semf',
213 'application/vnd.shana.informed.formdata' => 'ifm',
214 'application/vnd.shana.informed.formtemplate' => 'itp',
215 'application/vnd.shana.informed.interchange' => 'iif',
216 'application/vnd.shana.informed.package' => 'ipk',
217 'application/vnd.simtech-mindmapper' => ['twd', 'twds'],
218 'application/vnd.smaf' => 'mmf',
219 'application/vnd.stepmania.stepchart' => 'sm',
220 'application/vnd.sun.xml.calc' => 'sxc',
221 'application/vnd.sun.xml.calc.template' => 'stc',
222 'application/vnd.sun.xml.draw' => 'sxd',
223 'application/vnd.sun.xml.draw.template' => 'std',
224 'application/vnd.sun.xml.impress' => 'sxi',
225 'application/vnd.sun.xml.impress.template' => 'sti',
226 'application/vnd.sun.xml.math' => 'sxm',
227 'application/vnd.sun.xml.writer' => 'sxw',
228 'application/vnd.sun.xml.writer.global' => 'sxg',
229 'application/vnd.sun.xml.writer.template' => 'stw',
230 'application/vnd.sus-calendar' => ['sus', 'susp'],
231 'application/vnd.svd' => 'svd',
232 'application/vnd.symbian.install' => ['sis', 'sisx'],
233 'application/vnd.syncml+xml' => 'xsm',
234 'application/vnd.syncml.dm+wbxml' => 'bdm',
235 'application/vnd.syncml.dm+xml' => 'xdm',
236 'application/vnd.tao.intent-module-archive' => 'tao',
237 'application/vnd.tcpdump.pcap' => ['pcap', 'cap', 'dmp'],
238 'application/vnd.tmobile-livetv' => 'tmo',
239 'application/vnd.trid.tpt' => 'tpt',
240 'application/vnd.triscape.mxs' => 'mxs',
241 'application/vnd.trueapp' => 'tra',
242 'application/vnd.ufdl' => ['ufd', 'ufdl'],
243 'application/vnd.uiq.theme' => 'utz',
244 'application/vnd.umajin' => 'umj',
245 'application/vnd.unity' => 'unityweb',
246 'application/vnd.uoml+xml' => 'uoml',
247 'application/vnd.vcx' => 'vcx',
248 'application/vnd.visio' => ['vsd', 'vst', 'vss', 'vsw'],
249 'application/vnd.visionary' => 'vis',
250 'application/vnd.vsf' => 'vsf',
251 'application/vnd.wap.wbxml' => 'wbxml',
252 'application/vnd.wap.wmlc' => 'wmlc',
253 'application/vnd.wap.wmlscriptc' => 'wmlsc',
254 'application/vnd.webturbo' => 'wtb',
255 'application/vnd.wolfram.player' => 'nbp',
256 'application/vnd.wordperfect' => 'wpd',
257 'application/vnd.wqd' => 'wqd',
258 'application/vnd.wt.stf' => 'stf',
259 'application/vnd.xara' => 'xar',
260 'application/vnd.xfdl' => 'xfdl',
261 'application/voicexml+xml' => 'vxml',
262 'application/widget' => 'wgt',
263 'application/winhlp' => 'hlp',
264 'application/wsdl+xml' => 'wsdl',
265 'application/wspolicy+xml' => 'wspolicy',
266 'application/x-7z-compressed' => '7z',
267 'application/x-bittorrent' => 'torrent',
268 'application/x-blorb' => ['blb', 'blorb'],
269 'application/x-bzip' => 'bz',
270 'application/x-cdlink' => 'vcd',
271 'application/x-cfs-compressed' => 'cfs',
272 'application/x-chat' => 'chat',
273 'application/x-chess-pgn' => 'pgn',
274 'application/x-conference' => 'nsc',
275 'application/x-cpio' => 'cpio',
276 'application/x-csh' => 'csh',
277 'application/x-debian-package' => ['deb', 'udeb'],
278 'application/x-dgc-compressed' => 'dgc',
279 'application/x-director' => [
280 'dir',
281 'dcr',
282 'dxr',
283 'cst',
284 'cct',
285 'cxt',
286 'w3d',
287 'fgd',
288 'swa',
289 ],
290 'application/x-font-ttf' => ['ttf', 'ttc'],
291 'application/x-font-type1' => ['pfa', 'pfb', 'pfm', 'afm'],
292 'application/x-font-woff' => 'woff',
293 'application/x-freearc' => 'arc',
294 'application/x-futuresplash' => 'spl',
295 'application/x-gca-compressed' => 'gca',
296 'application/x-glulx' => 'ulx',
297 'application/x-gnumeric' => 'gnumeric',
298 'application/x-gramps-xml' => 'gramps',
299 'application/x-gtar' => 'gtar',
300 'application/x-hdf' => 'hdf',
301 'application/x-install-instructions' => 'install',
302 'application/x-iso9660-image' => 'iso',
303 'application/x-java-jnlp-file' => 'jnlp',
304 'application/x-latex' => 'latex',
305 'application/x-lzh-compressed' => ['lzh', 'lha'],
306 'application/x-mie' => 'mie',
307 'application/x-mobipocket-ebook' => ['prc', 'mobi'],
308 'application/x-ms-application' => 'application',
309 'application/x-ms-shortcut' => 'lnk',
310 'application/x-ms-wmd' => 'wmd',
311 'application/x-ms-wmz' => 'wmz',
312 'application/x-ms-xbap' => 'xbap',
313 'application/x-msaccess' => 'mdb',
314 'application/x-msbinder' => 'obd',
315 'application/x-mscardfile' => 'crd',
316 'application/x-msclip' => 'clp',
317 'application/x-msdownload' => ['exe', 'dll', 'com', 'bat', 'msi'],
318 'application/x-msmediaview' => [
319 'mvb',
320 'm13',
321 'm14',
322 ],
323 'application/x-msmetafile' => ['wmf', 'wmz', 'emf', 'emz'],
324 'application/x-rar-compressed' => 'rar',
325 'application/x-research-info-systems' => 'ris',
326 'application/x-sh' => 'sh',
327 'application/x-shar' => 'shar',
328 'application/x-shockwave-flash' => 'swf',
329 'application/x-silverlight-app' => 'xap',
330 'application/x-sql' => 'sql',
331 'application/x-stuffit' => 'sit',
332 'application/x-stuffitx' => 'sitx',
333 'application/x-subrip' => 'srt',
334 'application/x-sv4cpio' => 'sv4cpio',
335 'application/x-sv4crc' => 'sv4crc',
336 'application/x-t3vm-image' => 't3',
337 'application/x-tads' => 'gam',
338 'application/x-tar' => 'tar',
339 'application/x-tcl' => 'tcl',
340 'application/x-tex' => 'tex',
341 'application/x-tex-tfm' => 'tfm',
342 'application/x-texinfo' => ['texinfo', 'texi'],
343 'application/x-tgif' => 'obj',
344 'application/x-ustar' => 'ustar',
345 'application/x-wais-source' => 'src',
346 'application/x-x509-ca-cert' => ['der', 'crt'],
347 'application/x-xfig' => 'fig',
348 'application/x-xliff+xml' => 'xlf',
349 'application/x-xpinstall' => 'xpi',
350 'application/x-xz' => 'xz',
351 'application/x-zmachine' => 'z1',
352 'application/xaml+xml' => 'xaml',
353 'application/xcap-diff+xml' => 'xdf',
354 'application/xenc+xml' => 'xenc',
355 'application/xhtml+xml' => ['xhtml', 'xht'],
356 'application/xml' => ['xml', 'xsl'],
357 'application/xml-dtd' => 'dtd',
358 'application/xop+xml' => 'xop',
359 'application/xproc+xml' => 'xpl',
360 'application/xslt+xml' => 'xslt',
361 'application/xspf+xml' => 'xspf',
362 'application/xv+xml' => ['mxml', 'xhvml', 'xvml', 'xvm'],
363 'application/yang' => 'yang',
364 'application/yin+xml' => 'yin',
365 'application/zip' => 'zip',
366 'audio/adpcm' => 'adp',
367 'audio/basic' => ['au', 'snd'],
368 'audio/midi' => ['mid', 'midi', 'kar', 'rmi'],
369 'audio/mp4' => 'mp4a',
370 'audio/mpeg' => [
371 'mpga',
372 'mp2',
373 'mp2a',
374 'mp3',
375 'm2a',
376 'm3a',
377 ],
378 'audio/ogg' => ['oga', 'ogg', 'spx'],
379 'audio/vnd.dece.audio' => ['uva', 'uvva'],
380 'audio/vnd.rip' => 'rip',
381 'audio/webm' => 'weba',
382 'audio/x-aac' => 'aac',
383 'audio/x-aiff' => ['aif', 'aiff', 'aifc'],
384 'audio/x-caf' => 'caf',
385 'audio/x-flac' => 'flac',
386 'audio/x-matroska' => 'mka',
387 'audio/x-mpegurl' => 'm3u',
388 'audio/x-ms-wax' => 'wax',
389 'audio/x-ms-wma' => 'wma',
390 'audio/x-pn-realaudio' => ['ram', 'ra'],
391 'audio/x-pn-realaudio-plugin' => 'rmp',
392 'audio/x-wav' => 'wav',
393 'audio/xm' => 'xm',
394 'image/bmp' => 'bmp',
395 'image/cgm' => 'cgm',
396 'image/g3fax' => 'g3',
397 'image/gif' => 'gif',
398 'image/ief' => 'ief',
399 'image/jpeg' => ['jpeg', 'jpg', 'jpe'],
400 'image/ktx' => 'ktx',
401 'image/png' => 'png',
402 'image/prs.btif' => 'btif',
403 'image/sgi' => 'sgi',
404 'image/svg+xml' => ['svg', 'svgz'],
405 'image/tiff' => ['tiff', 'tif'],
406 'image/vnd.adobe.photoshop' => 'psd',
407 'image/vnd.dece.graphic' => ['uvi', 'uvvi', 'uvg', 'uvvg'],
408 'image/vnd.dvb.subtitle' => 'sub',
409 'image/vnd.djvu' => ['djvu', 'djv'],
410 'image/vnd.dwg' => 'dwg',
411 'image/vnd.dxf' => 'dxf',
412 'image/vnd.fastbidsheet' => 'fbs',
413 'image/vnd.fpx' => 'fpx',
414 'image/vnd.fst' => 'fst',
415 'image/vnd.fujixerox.edmics-mmr' => 'mmr',
416 'image/vnd.fujixerox.edmics-rlc' => 'rlc',
417 'image/vnd.ms-modi' => 'mdi',
418 'image/vnd.ms-photo' => 'wdp',
419 'image/vnd.net-fpx' => 'npx',
420 'image/vnd.wap.wbmp' => 'wbmp',
421 'image/vnd.xiff' => 'xif',
422 'image/webp' => 'webp',
423 'image/x-3ds' => '3ds',
424 'image/x-cmu-raster' => 'ras',
425 'image/x-cmx' => 'cmx',
426 'image/x-freehand' => ['fh', 'fhc', 'fh4', 'fh5', 'fh7'],
427 'image/x-icon' => 'ico',
428 'image/x-mrsid-image' => 'sid',
429 'image/x-pcx' => 'pcx',
430 'image/x-pict' => ['pic', 'pct'],
431 'image/x-portable-anymap' => 'pnm',
432 'image/x-portable-bitmap' => 'pbm',
433 'image/x-portable-graymap' => 'pgm',
434 'image/x-portable-pixmap' => 'ppm',
435 'image/x-rgb' => 'rgb',
436 'image/x-tga' => 'tga',
437 'image/x-xbitmap' => 'xbm',
438 'image/x-xpixmap' => 'xpm',
439 'image/x-xwindowdump' => 'xwd',
440 'message/rfc822' => ['eml', 'mime'],
441 'model/iges' => ['igs', 'iges'],
442 'model/mesh' => ['msh', 'mesh', 'silo'],
443 'model/vnd.collada+xml' => 'dae',
444 'model/vnd.dwf' => 'dwf',
445 'model/vnd.gdl' => 'gdl',
446 'model/vnd.gtw' => 'gtw',
447 'model/vnd.mts' => 'mts',
448 'model/vnd.vtu' => 'vtu',
449 'model/vrml' => ['wrl', 'vrml'],
450 'model/x3d+binary' => 'x3db',
451 'model/x3d+vrml' => 'x3dv',
452 'model/x3d+xml' => 'x3d',
453 'text/cache-manifest' => 'appcache',
454 'text/calendar' => ['ics', 'ifb'],
455 'text/css' => 'css',
456 'text/csv' => 'csv',
457 'text/html' => ['html', 'htm'],
458 'text/n3' => 'n3',
459 'text/plain' => [
460 'txt',
461 'text',
462 'conf',
463 'def',
464 'list',
465 'log',
466 'in',
467 ],
468 'text/prs.lines.tag' => 'dsc',
469 'text/richtext' => 'rtx',
470 'text/sgml' => ['sgml', 'sgm'],
471 'text/tab-separated-values' => 'tsv',
472 'text/troff' => [
473 't',
474 'tr',
475 'roff',
476 'man',
477 'me',
478 'ms',
479 ],
480 'text/turtle' => 'ttl',
481 'text/uri-list' => ['uri', 'uris', 'urls'],
482 'text/vcard' => 'vcard',
483 'text/vnd.curl' => 'curl',
484 'text/vnd.curl.dcurl' => 'dcurl',
485 'text/vnd.curl.scurl' => 'scurl',
486 'text/vnd.curl.mcurl' => 'mcurl',
487 'text/vnd.dvb.subtitle' => 'sub',
488 'text/vnd.fly' => 'fly',
489 'text/vnd.fmi.flexstor' => 'flx',
490 'text/vnd.graphviz' => 'gv',
491 'text/vnd.in3d.3dml' => '3dml',
492 'text/vnd.in3d.spot' => 'spot',
493 'text/vnd.sun.j2me.app-descriptor' => 'jad',
494 'text/vnd.wap.wml' => 'wml',
495 'text/vnd.wap.wmlscript' => 'wmls',
496 'text/x-asm' => ['s', 'asm'],
497 'text/x-fortran' => ['f', 'for', 'f77', 'f90'],
498 'text/x-java-source' => 'java',
499 'text/x-opml' => 'opml',
500 'text/x-pascal' => ['p', 'pas'],
501 'text/x-nfo' => 'nfo',
502 'text/x-setext' => 'etx',
503 'text/x-sfv' => 'sfv',
504 'text/x-uuencode' => 'uu',
505 'text/x-vcalendar' => 'vcs',
506 'text/x-vcard' => 'vcf',
507 'video/3gpp' => '3gp',
508 'video/3gpp2' => '3g2',
509 'video/h261' => 'h261',
510 'video/h263' => 'h263',
511 'video/h264' => 'h264',
512 'video/jpeg' => 'jpgv',
513 'video/jpm' => ['jpm', 'jpgm'],
514 'video/mj2' => 'mj2',
515 'video/mp4' => 'mp4',
516 'video/mpeg' => ['mpeg', 'mpg', 'mpe', 'm1v', 'm2v'],
517 'video/ogg' => 'ogv',
518 'video/quicktime' => ['qt', 'mov'],
519 'video/vnd.dece.hd' => ['uvh', 'uvvh'],
520 'video/vnd.dece.mobile' => ['uvm', 'uvvm'],
521 'video/vnd.dece.pd' => ['uvp', 'uvvp'],
522 'video/vnd.dece.sd' => ['uvs', 'uvvs'],
523 'video/vnd.dece.video' => ['uvv', 'uvvv'],
524 'video/vnd.dvb.file' => 'dvb',
525 'video/vnd.fvt' => 'fvt',
526 'video/vnd.mpegurl' => ['mxu', 'm4u'],
527 'video/vnd.ms-playready.media.pyv' => 'pyv',
528 'video/vnd.uvvu.mp4' => ['uvu', 'uvvu'],
529 'video/vnd.vivo' => 'viv',
530 'video/webm' => 'webm',
531 'video/x-f4v' => 'f4v',
532 'video/x-fli' => 'fli',
533 'video/x-flv' => 'flv',
534 'video/x-m4v' => 'm4v',
535 'video/x-matroska' => ['mkv', 'mk3d', 'mks'],
536 'video/x-mng' => 'mng',
537 'video/x-ms-asf' => ['asf', 'asx'],
538 'video/x-ms-vob' => 'vob',
539 'video/x-ms-wm' => 'wm',
540 'video/x-ms-wmv' => 'wmv',
541 'video/x-ms-wmx' => 'wmx',
542 'video/x-ms-wvx' => 'wvx',
543 'video/x-msvideo' => 'avi',
544 'video/x-sgi-movie' => 'movie',
545 ];
546
547 /**
548 * Get a random MIME type
549 *
550 * @return string
551 *
552 * @example 'video/avi'
553 */
554 public static function mimeType()
555 {
556 return static::randomElement(array_keys(static::$mimeTypes));
557 }
558
559 /**
560 * Get a random file extension (without a dot)
561 *
562 * @example avi
563 *
564 * @return string
565 */
566 public static function fileExtension()
567 {
568 $random_extension = static::randomElement(array_values(static::$mimeTypes));
569
570 return is_array($random_extension) ? static::randomElement($random_extension) : $random_extension;
571 }
572
573 /**
574 * Copy a random file from the source directory to the target directory and returns the filename/fullpath
575 *
576 * @param string $sourceDirectory The directory to look for random file taking
577 * @param string $targetDirectory
578 * @param bool $fullPath Whether to have the full path or just the filename
579 *
580 * @return string
581 */
582 public static function file($sourceDirectory = '/tmp', $targetDirectory = '/tmp', $fullPath = true)
583 {
584 if (!is_dir($sourceDirectory)) {
585 throw new \InvalidArgumentException(sprintf('Source directory %s does not exist or is not a directory.', $sourceDirectory));
586 }
587
588 if (!is_dir($targetDirectory)) {
589 throw new \InvalidArgumentException(sprintf('Target directory %s does not exist or is not a directory.', $targetDirectory));
590 }
591
592 if ($sourceDirectory == $targetDirectory) {
593 throw new \InvalidArgumentException('Source and target directories must differ.');
594 }
595
596 // Drop . and .. and reset array keys
597 $files = array_filter(array_values(array_diff(scandir($sourceDirectory), ['.', '..'])), static function ($file) use ($sourceDirectory) {
598 return is_file($sourceDirectory . DIRECTORY_SEPARATOR . $file) && is_readable($sourceDirectory . DIRECTORY_SEPARATOR . $file);
599 });
600
601 if (empty($files)) {
602 throw new \InvalidArgumentException(sprintf('Source directory %s is empty.', $sourceDirectory));
603 }
604
605 $sourceFullPath = $sourceDirectory . DIRECTORY_SEPARATOR . static::randomElement($files);
606
607 $destinationFile = Uuid::uuid() . '.' . pathinfo($sourceFullPath, PATHINFO_EXTENSION);
608 $destinationFullPath = $targetDirectory . DIRECTORY_SEPARATOR . $destinationFile;
609
610 if (false === copy($sourceFullPath, $destinationFullPath)) {
611 return false;
612 }
613
614 return $fullPath ? $destinationFullPath : $destinationFile;
615 }
616 }
617