1+ <?php
2+
3+
4+ namespace Flowpack \Prunner \Dto ;
5+
6+ use Neos \Flow \Annotations as Flow ;
7+
8+ /**
9+ * @Flow\Proxy(false)
10+ */
11+ class Job
12+ {
13+ private string $ id ;
14+ /**
15+ * @var string Pipeline name
16+ */
17+ private string $ pipeline ;
18+ private TaskResults $ taskResults ;
19+ private bool $ completed ;
20+ private bool $ canceled ;
21+ private bool $ errored ;
22+ private \DateTimeImmutable $ created ;
23+ private ?\DateTimeImmutable $ start ;
24+ private ?\DateTimeImmutable $ end ;
25+ private ?string $ lastError ;
26+ private array $ variables ;
27+ private string $ user ;
28+
29+ public static function fromJsonArray (array $ in ): self
30+ {
31+ $ job = new static ();
32+ $ job ->id = $ in ['id ' ];
33+ $ job ->pipeline = $ in ['pipeline ' ];
34+ $ job ->taskResults = TaskResults::fromJsonArray ($ in ['tasks ' ]);;
35+ $ job ->completed = $ in ['completed ' ];
36+ $ job ->canceled = $ in ['canceled ' ];
37+ $ job ->errored = $ in ['errored ' ];
38+ $ job ->created = \DateTimeImmutable::createFromFormat (\DateTimeInterface::W3C , $ in ['created ' ]);
39+ $ job ->start = isset ($ in ['start ' ]) ? \DateTimeImmutable::createFromFormat (\DateTimeInterface::W3C , $ in ['start ' ]) : null ;
40+ $ job ->end = isset ($ in ['end ' ]) ? \DateTimeImmutable::createFromFormat (\DateTimeInterface::W3C , $ in ['end ' ]) : null ;
41+ $ job ->lastError = $ in ['lastError ' ];
42+ $ job ->variables = $ in ['variables ' ] ?? [];
43+ $ job ->user = $ in ['user ' ];
44+
45+ return $ job ;
46+ }
47+
48+ /**
49+ * @return string
50+ */
51+ public function getId (): string
52+ {
53+ return $ this ->id ;
54+ }
55+
56+ public function getPipeline (): string
57+ {
58+ return $ this ->pipeline ;
59+ }
60+
61+ public function getTaskResults (): TaskResults
62+ {
63+ return $ this ->taskResults ;
64+ }
65+
66+ public function isCompleted (): bool
67+ {
68+ return $ this ->completed ;
69+ }
70+
71+ public function isCanceled (): bool
72+ {
73+ return $ this ->canceled ;
74+ }
75+
76+ public function isErrored (): bool
77+ {
78+ return $ this ->errored ;
79+ }
80+
81+ public function getCreated (): \DateTimeImmutable
82+ {
83+ return $ this ->created ;
84+ }
85+
86+ public function getStart (): ?\DateTimeImmutable
87+ {
88+ return $ this ->start ;
89+ }
90+
91+ public function getEnd (): ?\DateTimeImmutable
92+ {
93+ return $ this ->end ;
94+ }
95+
96+ public function getLastError (): ?string
97+ {
98+ return $ this ->lastError ;
99+ }
100+
101+ public function getVariables (): array
102+ {
103+ return $ this ->variables ;
104+ }
105+
106+ public function getUser (): string
107+ {
108+ return $ this ->user ;
109+ }
110+ }
0 commit comments