summaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
authorSimon Rettberg2022-05-12 17:48:14 +0200
committerSimon Rettberg2022-05-12 17:48:14 +0200
commit5aeb909630fe3418a92d8ef57e5aa9270afad673 (patch)
tree0eb034c34fc5e70a9274192ee51443b59b7049a0 /inc
parent[statistics] install: Remove bogus SCREEN entries on update (diff)
downloadslx-admin-5aeb909630fe3418a92d8ef57e5aa9270afad673.tar.gz
slx-admin-5aeb909630fe3418a92d8ef57e5aa9270afad673.tar.xz
slx-admin-5aeb909630fe3418a92d8ef57e5aa9270afad673.zip
[inc/Download] Add types
Diffstat (limited to 'inc')
-rw-r--r--inc/download.inc.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/inc/download.inc.php b/inc/download.inc.php
index 5a71014e..3986bc40 100644
--- a/inc/download.inc.php
+++ b/inc/download.inc.php
@@ -3,13 +3,17 @@
class Download
{
+ /**
+ * @var false|resource
+ */
private static $curlHandle = false;
/**
* Common initialization for download and downloadToFile
* Return file handle to header file
+ * @return false|resource
*/
- private static function initCurl($url, $timeout, &$head)
+ private static function initCurl(string $url, int $timeout, &$head)
{
if (self::$curlHandle === false) {
self::$curlHandle = curl_init();
@@ -51,7 +55,7 @@ class Download
* Download file, obey given timeout in seconds
* Return data on success, false on failure
*/
- public static function asString($url, $timeout, &$code)
+ public static function asString(string $url, int $timeout, &$code)
{
$ch = self::initCurl($url, $timeout, $head);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@@ -73,7 +77,7 @@ class Download
* @param int $timeout timeout in seconds
* @param int $code HTTP response code, or 999 on error
*/
- public static function asStringPost($url, $params, $timeout, &$code)
+ public static function asStringPost(string $url, $params, int $timeout, &$code)
{
$string = '';
if (is_array($params)) {
@@ -107,7 +111,7 @@ class Download
* @param int $code HTTP status code passed out by reference
* @return boolean
*/
- public static function toFile($target, $url, $timeout, &$code)
+ public static function toFile(string $target, string $url, int $timeout, &$code): bool
{
$fh = fopen($target, 'wb');
if ($fh === false)