-
Notifications
You must be signed in to change notification settings - Fork 0
/
Job.php
38 lines (32 loc) · 1.01 KB
/
Job.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
declare(strict_types=1);
namespace Wearesho\Yii\Guzzle\Log;
use Horat1us\Yii\Validation;
use yii\queue;
class Job implements queue\JobInterface
{
private array $request;
private ?array $response;
private ?array $exception;
public function __construct(array $request, ?array $response, ?array $exception)
{
$this->request = $request;
$this->response = $response;
$this->exception = $exception;
}
public function execute($queue): void
{
$request = new Request($this->request);
Validation\Exception::saveOrThrow($request);
if (!is_null($this->response)) {
$response = new Response($this->response);
$response->setRequest($request);
Validation\Exception::saveOrThrow($response);
}
if (!is_null($this->exception)) {
$exception = new Exception($this->exception);
$exception->setRequest($request);
Validation\Exception::saveOrThrow($exception);
}
}
}