PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 3.1.0
Defender Security – Malware Scanner, Login Security & Firewall v3.1.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / vendor / thecodingmachine / safe / generated / fileinfo.php

fileinfo.php in Defender Security – Malware Scanner, Login Security & Firewall 3.1.0, at vendor/thecodingmachine/safe/generated/fileinfo.php

76 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Safe;
4
5 use Safe\Exceptions\FileinfoException;
6
7 /**
8 * This function closes the resource opened by finfo_open.
9 *
10 * @param resource $finfo Fileinfo resource returned by finfo_open.
11 * @throws FileinfoException
12 *
13 */
14 function finfo_close($finfo): void
15 {
16 error_clear_last();
17 $result = \finfo_close($finfo);
18 if ($result === false) {
19 throw FileinfoException::createFromPhpError();
20 }
21 }
22
23
24 /**
25 * Procedural style
26 *
27 * Object oriented style (constructor):
28 *
29 * This function opens a magic database and returns its resource.
30 *
31 * @param int $options One or disjunction of more Fileinfo
32 * constants.
33 * @param string $magic_file Name of a magic database file, usually something like
34 * /path/to/magic.mime. If not specified, the
35 * MAGIC environment variable is used. If the
36 * environment variable isn't set, then PHP's bundled magic database will
37 * be used.
38 *
39 * Passing NULL or an empty string will be equivalent to the default
40 * value.
41 * @return resource (Procedural style only)
42 * Returns a magic database resource on success.
43 * @throws FileinfoException
44 *
45 */
46 function finfo_open(int $options = FILEINFO_NONE, string $magic_file = "")
47 {
48 error_clear_last();
49 $result = \finfo_open($options, $magic_file);
50 if ($result === false) {
51 throw FileinfoException::createFromPhpError();
52 }
53 return $result;
54 }
55
56
57 /**
58 * Returns the MIME content type for a file as determined by using
59 * information from the magic.mime file.
60 *
61 * @param string $filename Path to the tested file.
62 * @return string Returns the content type in MIME format, like
63 * text/plain or application/octet-stream.
64 * @throws FileinfoException
65 *
66 */
67 function mime_content_type(string $filename): string
68 {
69 error_clear_last();
70 $result = \mime_content_type($filename);
71 if ($result === false) {
72 throw FileinfoException::createFromPhpError();
73 }
74 return $result;
75 }
76