diff options
author | Andrew Dolgov <[email protected]> | 2021-02-26 19:16:17 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-26 19:16:17 +0300 |
commit | 3fd785654372d493c031d9b541ab33a881023a32 (patch) | |
tree | 0a76cb410217074378de3d7012b95754cd3c7e6f /vendor/thecodingmachine/safe/generated/fileinfo.php | |
parent | bc4475b6698f5a74e475674aa7af43253c459892 (diff) |
* switch to composer for qrcode and otp dependencies
* move most OTP-related stuff into userhelper
* remove old phpqrcode and otphp libraries
Diffstat (limited to 'vendor/thecodingmachine/safe/generated/fileinfo.php')
-rw-r--r-- | vendor/thecodingmachine/safe/generated/fileinfo.php | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/vendor/thecodingmachine/safe/generated/fileinfo.php b/vendor/thecodingmachine/safe/generated/fileinfo.php new file mode 100644 index 000000000..50345b67c --- /dev/null +++ b/vendor/thecodingmachine/safe/generated/fileinfo.php @@ -0,0 +1,75 @@ +<?php + +namespace Safe; + +use Safe\Exceptions\FileinfoException; + +/** + * This function closes the resource opened by finfo_open. + * + * @param resource $finfo Fileinfo resource returned by finfo_open. + * @throws FileinfoException + * + */ +function finfo_close($finfo): void +{ + error_clear_last(); + $result = \finfo_close($finfo); + if ($result === false) { + throw FileinfoException::createFromPhpError(); + } +} + + +/** + * Procedural style + * + * Object oriented style (constructor): + * + * This function opens a magic database and returns its resource. + * + * @param int $options One or disjunction of more Fileinfo + * constants. + * @param string $magic_file Name of a magic database file, usually something like + * /path/to/magic.mime. If not specified, the + * MAGIC environment variable is used. If the + * environment variable isn't set, then PHP's bundled magic database will + * be used. + * + * Passing NULL or an empty string will be equivalent to the default + * value. + * @return resource (Procedural style only) + * Returns a magic database resource on success. + * @throws FileinfoException + * + */ +function finfo_open(int $options = FILEINFO_NONE, string $magic_file = "") +{ + error_clear_last(); + $result = \finfo_open($options, $magic_file); + if ($result === false) { + throw FileinfoException::createFromPhpError(); + } + return $result; +} + + +/** + * Returns the MIME content type for a file as determined by using + * information from the magic.mime file. + * + * @param string $filename Path to the tested file. + * @return string Returns the content type in MIME format, like + * text/plain or application/octet-stream. + * @throws FileinfoException + * + */ +function mime_content_type(string $filename): string +{ + error_clear_last(); + $result = \mime_content_type($filename); + if ($result === false) { + throw FileinfoException::createFromPhpError(); + } + return $result; +} |