1 | <?php |
||
16 | abstract class Result implements Arrayable, Jsonable, JsonSerializable |
||
17 | { |
||
18 | /* ----------------------------------------------------------------- |
||
19 | | Traits |
||
20 | | ----------------------------------------------------------------- |
||
21 | */ |
||
22 | |||
23 | 1 | use ConvertsToArray; |
|
24 | |||
25 | /* ----------------------------------------------------------------- |
||
26 | | Properties |
||
27 | | ----------------------------------------------------------------- |
||
28 | */ |
||
29 | |||
30 | /** |
||
31 | * The result value. |
||
32 | * |
||
33 | * @var mixed|null |
||
34 | */ |
||
35 | public $value; |
||
36 | |||
37 | /** |
||
38 | * The result prefix |
||
39 | * |
||
40 | * @var string|null |
||
41 | */ |
||
42 | public $prefix; |
||
43 | |||
44 | /** |
||
45 | * The result suffix. |
||
46 | * |
||
47 | * @var string|null |
||
48 | */ |
||
49 | public $suffix; |
||
50 | |||
51 | /** |
||
52 | * The result format. |
||
53 | * |
||
54 | * @var string |
||
55 | */ |
||
56 | public $format; |
||
57 | |||
58 | /* ----------------------------------------------------------------- |
||
59 | | Constructor |
||
60 | | ----------------------------------------------------------------- |
||
61 | */ |
||
62 | |||
63 | /** |
||
64 | * Result constructor. |
||
65 | * |
||
66 | * @param mixed|null $value |
||
67 | */ |
||
68 | 248 | public function __construct($value = null) |
|
72 | |||
73 | /* ----------------------------------------------------------------- |
||
74 | | Setters |
||
75 | | ----------------------------------------------------------------- |
||
76 | */ |
||
77 | |||
78 | /** |
||
79 | * Set the value. |
||
80 | * |
||
81 | * @param mixed $value |
||
82 | * |
||
83 | * @return $this |
||
84 | */ |
||
85 | 248 | public function value($value) |
|
91 | |||
92 | /** |
||
93 | * Set the result prefix. |
||
94 | * |
||
95 | * @param string $prefix |
||
96 | * |
||
97 | * @return $this |
||
98 | */ |
||
99 | 48 | public function prefix(string $prefix) |
|
105 | |||
106 | /** |
||
107 | * Set the result suffix. |
||
108 | * |
||
109 | * @param string $suffix |
||
110 | * |
||
111 | * @return $this |
||
112 | */ |
||
113 | 48 | public function suffix(string $suffix) |
|
119 | |||
120 | /** |
||
121 | * Set the result format. |
||
122 | * |
||
123 | * @param string $format |
||
124 | * |
||
125 | * @return $this |
||
126 | */ |
||
127 | 48 | public function format(string $format) |
|
133 | |||
134 | /* ----------------------------------------------------------------- |
||
135 | | Other Methods |
||
136 | | ----------------------------------------------------------------- |
||
137 | */ |
||
138 | |||
139 | /** |
||
140 | * Get the instance as an array. |
||
141 | * |
||
142 | * @return array |
||
143 | */ |
||
144 | 72 | public function toArray(): array |
|
153 | } |
||
154 |