Compare commits

..

No commits in common. "master" and "1.0.0" have entirely different histories.

2 changed files with 5 additions and 17 deletions

View File

@ -2,7 +2,7 @@
namespace Negundo\Client\Task; namespace Negundo\Client\Task;
class TaskReport implements \JsonSerializable class TaskReport
{ {
protected array $events = []; protected array $events = [];
@ -13,7 +13,6 @@ class TaskReport implements \JsonSerializable
public array $data = [], public array $data = [],
) {} ) {}
public function addData(string $name, array $data) : static public function addData(string $name, array $data) : static
{ {
$this->data[$name][] = $data; $this->data[$name][] = $data;
@ -61,24 +60,13 @@ class TaskReport implements \JsonSerializable
return $this->data; return $this->data;
} }
public function getEvents(?StatusEnum $filterType = null) : array public function getEvents() : array
{ {
return $filterType ? array_filter($this->events, fn($e) => StatusEnum::tryFrom($e['status']) === $filterType) : $this->events; return $this->events;
} }
public function getStatus() : StatusEnum public function getStatus() : StatusEnum
{ {
return $this->status; return $this->status;
} }
public function jsonSerialize(): mixed
{
return [
'title' => $this->getTitle(),
'message' => $this->getMessage(),
'status' => $this->getStatus(),
'events' => $this->getEvents(),
'data' => $this->getData(),
];
}
} }

View File

@ -4,7 +4,7 @@ namespace Negundo\Client\Transport;
class Curl implements TransportInterface { class Curl implements TransportInterface {
public $timeout = 4; public $timeout = 100;
public $throwErrors = true; public $throwErrors = true;
@ -21,7 +21,7 @@ class Curl implements TransportInterface {
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers ); curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers );
curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data, '', '&')); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data, '', '&'));
curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->timeout * 200);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->verifySsl); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->verifySsl);
$exec = curl_exec($ch); $exec = curl_exec($ch);