mirror of
https://github.com/MetaProvide/talked-client.git
synced 2025-04-27 05:30:48 +00:00
Add some more type hints
This commit is contained in:
parent
53b0b2549e
commit
937fc023fa
1 changed files with 4 additions and 4 deletions
|
@ -142,7 +142,7 @@ You have the following options available:
|
||||||
return 0;
|
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')) {
|
if ($this->config->getAppValue('talked', 'server_url', '0')) {
|
||||||
$headers = $this->addBasicAuthHeaders($headers);
|
$headers = $this->addBasicAuthHeaders($headers);
|
||||||
}
|
}
|
||||||
|
@ -168,13 +168,13 @@ You have the following options available:
|
||||||
return $message;
|
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')) {
|
if ($this->config->getAppValue('talked', 'server_url', '0')) {
|
||||||
$headers = $this->addBasicAuthHeaders($headers);
|
$headers = $this->addBasicAuthHeaders($headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers[] = 'Content-Type: application/json';
|
$headers[] = 'Content-Type: application/json';
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $serverUrl . '/' . $endpoint);
|
curl_setopt($ch, CURLOPT_URL, $serverUrl . '/' . $endpoint);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
@ -198,7 +198,7 @@ You have the following options available:
|
||||||
return $message;
|
return $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function addBasicAuthHeaders() {
|
protected function addBasicAuthHeaders(): array {
|
||||||
$username = $this->config->getAppValue('talked', 'http_basic_auth_username');
|
$username = $this->config->getAppValue('talked', 'http_basic_auth_username');
|
||||||
$password = $this->config->getAppValue('talked', 'http_basic_auth_password');
|
$password = $this->config->getAppValue('talked', 'http_basic_auth_password');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue