Specify global namespace for more calls to build-in functions

This commit is contained in:
Joshua Ramon Enslin 2020-08-22 23:57:37 +02:00 committed by Stefan Rohde-Enslin
parent 25b3138a26
commit b39f26a3f7

View File

@ -91,7 +91,7 @@ class MD_STD {
*/
public static function startsWith(string $haystack, string $needle):bool {
if (substr($haystack, 0, strlen($needle)) == $needle) return true;
if (substr($haystack, 0, \strlen($needle)) == $needle) return true;
else return false;
}
@ -179,19 +179,19 @@ class MD_STD {
*/
public static function runCurl(string $url, int $timeout = 1200):string {
$curl = curl_init();
$curl = \curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, $timeout); //timeout in seconds
curl_setopt($curl, CURLOPT_TIMEOUT_MS, $timeout); //timeout in seconds
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_USERAGENT, 'md-bot/1.0');
$result = curl_exec($curl);
\curl_setopt($curl, CURLOPT_URL, $url);
\curl_setopt($curl, CURLOPT_HEADER, false);
\curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, $timeout); //timeout in seconds
\curl_setopt($curl, CURLOPT_TIMEOUT_MS, $timeout); //timeout in seconds
\curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
\curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
\curl_setopt($curl, CURLOPT_USERAGENT, 'md-bot/1.0');
$result = \curl_exec($curl);
curl_close($curl);
if (is_bool($result)) return "";
\curl_close($curl);
if (\is_bool($result)) return "";
return $result;
}
@ -293,7 +293,7 @@ class MD_STD {
*/
public static function filesize(string $filename):int {
$output = filesize($filename);
$output = \filesize($filename);
if ($output === false) {
throw new Exception("Cannot get filesize of file {$filename}");