Files
kulakpos_web/vendor/thecodingmachine/safe/generated/8.1/url.php

82 lines
1.7 KiB
PHP
Raw Normal View History

2026-03-30 14:54:57 +07:00
<?php
namespace Safe;
use Safe\Exceptions\UrlException;
/**
2026-04-18 20:32:18 +07:00
* @param string $string
* @param bool $strict
* @return string
2026-03-30 14:54:57 +07:00
* @throws UrlException
*
*/
function base64_decode(string $string, bool $strict = false): string
{
error_clear_last();
$safeResult = \base64_decode($string, $strict);
if ($safeResult === false) {
throw UrlException::createFromPhpError();
}
return $safeResult;
}
/**
2026-04-18 20:32:18 +07:00
* @param string $url
* @param bool $associative
* @param null|resource $context
* @return array
2026-03-30 14:54:57 +07:00
* @throws UrlException
*
*/
function get_headers(string $url, bool $associative = false, $context = null): array
{
error_clear_last();
if ($context !== null) {
$safeResult = \get_headers($url, $associative, $context);
} else {
$safeResult = \get_headers($url, $associative);
}
if ($safeResult === false) {
throw UrlException::createFromPhpError();
}
return $safeResult;
}
/**
2026-04-18 20:32:18 +07:00
* @param string $filename
* @param bool $use_include_path
* @return array
2026-03-30 14:54:57 +07:00
* @throws UrlException
*
*/
function get_meta_tags(string $filename, bool $use_include_path = false): array
{
error_clear_last();
$safeResult = \get_meta_tags($filename, $use_include_path);
if ($safeResult === false) {
throw UrlException::createFromPhpError();
}
return $safeResult;
}
/**
2026-04-18 20:32:18 +07:00
* @param string $url
* @param int $component
* @return array|int|null|string
2026-03-30 14:54:57 +07:00
* @throws UrlException
*
*/
function parse_url(string $url, int $component = -1)
{
error_clear_last();
$safeResult = \parse_url($url, $component);
if ($safeResult === false) {
throw UrlException::createFromPhpError();
}
return $safeResult;
}