1
0
Fork 0
mirror of https://github.com/MetaProvide/talked-client.git synced 2025-04-14 08:58:34 +00:00

Add some more type hints

This commit is contained in:
Magnus Walbeck 2021-09-06 12:54:18 +02:00
parent 53b0b2549e
commit 937fc023fa
Signed by: mwalbeck
GPG key ID: CCB78CFF3F950769

View file

@ -142,7 +142,7 @@ You have the following options available:
return 0;
}
protected function sendGetRequest($serverUrl, $endpoint, $headers = []) {
protected function sendGetRequest(string $serverUrl, string $endpoint, array $headers = []): string {
if ($this->config->getAppValue('talked', 'server_url', '0')) {
$headers = $this->addBasicAuthHeaders($headers);
}
@ -168,13 +168,13 @@ You have the following options available:
return $message;
}
protected function sendPostRequest($serverUrl, $endpoint, $payload, $headers = []) {
protected function sendPostRequest(string $serverUrl, string $endpoint, array $payload, array $headers = []): string {
if ($this->config->getAppValue('talked', 'server_url', '0')) {
$headers = $this->addBasicAuthHeaders($headers);
}
$headers[] = 'Content-Type: application/json';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $serverUrl . '/' . $endpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@ -198,7 +198,7 @@ You have the following options available:
return $message;
}
protected function addBasicAuthHeaders() {
protected function addBasicAuthHeaders(): array {
$username = $this->config->getAppValue('talked', 'http_basic_auth_username');
$password = $this->config->getAppValue('talked', 'http_basic_auth_password');