скорректирована структура
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Rsgrinko\IotApi;
|
||||
|
||||
class Narodmon
|
||||
{
|
||||
private const API_ENDPOINT = 'http://narodmon.ru/post';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Rsgrinko\IotApi;
|
||||
class Prometheus
|
||||
{
|
||||
private array $data = [];
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Rsgrinko\IotApi;
|
||||
|
||||
class YandexIoT
|
||||
{
|
||||
private string $clientId;
|
||||
@@ -28,7 +30,7 @@ class YandexIoT
|
||||
throw new RuntimeException('Файл для инициализации не найден');
|
||||
}
|
||||
$data = json_decode(file_get_contents($file), true, 512, JSON_THROW_ON_ERROR);
|
||||
$this->accessToken = $data['access_token'] ?? null;
|
||||
$this->accessToken = $data['access_token'] ?? null;
|
||||
$this->refreshToken = $data['access_token'] ?? null;
|
||||
return $this;
|
||||
}
|
||||
@@ -43,8 +45,12 @@ class YandexIoT
|
||||
* @return array
|
||||
* @throws JsonException
|
||||
*/
|
||||
public static function sendRequest(string $url, array $headers = [], ?array $data = null, ?string $method = null): array
|
||||
{
|
||||
public static function sendRequest(
|
||||
string $url,
|
||||
array $headers = [],
|
||||
?array $data = null,
|
||||
?string $method = null
|
||||
): array {
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user