-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOperation.php
51 lines (45 loc) · 969 Bytes
/
Operation.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
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace App\Core\Framework\Structures;
class Operation
{
/**
* Represents the result of an operation.
*
* @var bool
*/
public bool $result;
/**
* Represents the message associated with the operation.
*
* @var string
*/
public string $message;
/**
* Represents the data associated with the operation.
*
* @var array
*/
public array $data;
/**
* Operation constructor.
*
* @param bool $result The result of the operation.
* @param string $message The message associated with the operation.
* @param array $data The data associated with the operation.
*/
public function __construct(bool $result, string $message, array $data = [])
{
$this->result = $result;
$this->message = $message;
$this->data = $data;
}
/**
* Converts the Operation object to JSON format.
*
* @return string The JSON representation of the Operation object.
*/
public function __toJSON()
{
return json_encode($this);
}
}