ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
Wrapper.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24
25class Wrapper implements WrapperInterface
26{
27 protected JobResult $result;
28
29 public function __construct(JobResult $result)
30 {
31 $this->result = $result;
32 }
33
34 public function get(): JobResult
35 {
36 return $this->result;
37 }
38
39 public function withStatus(int $status): WrapperInterface
40 {
41 $clone = clone $this;
42 $clone->result->setStatus($status);
43 return $clone;
44 }
45
46 public function withMessage(string $message): WrapperInterface
47 {
48 $clone = clone $this;
49 $clone->result->setMessage($message);
50 return $clone;
51 }
52
53 public function __clone(): void
54 {
55 $this->result = clone $this->result;
56 }
57}