|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Deploid; |
|
4
|
|
|
|
|
5
|
|
|
class Payload { |
|
6
|
|
|
|
|
7
|
|
|
const STRUCTURE_VALIDATE_SUCCESS = 'structure_validate_success'; |
|
8
|
|
|
const STRUCTURE_VALIDATE_FAIL = 'structure_validate_fail'; |
|
9
|
|
|
const STRUCTURE_INIT_SUCCESS = 'structure_init_success'; |
|
10
|
|
|
const STRUCTURE_INIT_FAIL = 'structure_init_fail'; |
|
11
|
|
|
const STRUCTURE_CLEAN_SUCCESS = 'structure_clean_success'; |
|
12
|
|
|
const STRUCTURE_CLEAN_FAIL = 'structure_clean_fail'; |
|
13
|
|
|
const RELEASE_EXIST_SUCCESS = 'release_exist_success'; |
|
14
|
|
|
const RELEASE_EXIST_FAIL = 'release_exist_fail'; |
|
15
|
|
|
const RELEASE_CREATE_SUCCESS = 'release_create_success'; |
|
16
|
|
|
const RELEASE_CREATE_FAIL = 'release_create_fail'; |
|
17
|
|
|
const RELEASE_REMOVE_SUCCESS = 'release_remove_success'; |
|
18
|
|
|
const RELEASE_REMOVE_FAIL = 'release_remove_fail'; |
|
19
|
|
|
const RELEASE_CURRENT_SUCCESS = 'release_current_success'; |
|
20
|
|
|
const RELEASE_CURRENT_FAIL = 'release_current_fail'; |
|
21
|
|
|
const RELEASE_SETUP_SUCCESS = 'release_setup_success'; |
|
22
|
|
|
const RELEASE_SETUP_FAIL = 'release_setup_fail'; |
|
23
|
|
|
const RELEASE_LIST_SUCCESS = 'release_list_success'; |
|
24
|
|
|
const RELEASE_LIST_FAIL = 'release_list_fail'; |
|
25
|
|
|
const RELEASE_ROTATE_SUCCESS = 'release_rotate_success'; |
|
26
|
|
|
const RELEASE_ROTATE_FAIL = 'release_rotate_fail'; |
|
27
|
|
|
const RELEASE_LATEST_SUCCESS = 'release_latest_success'; |
|
28
|
|
|
const RELEASE_LATEST_FAIL = 'release_latest_fail'; |
|
29
|
|
|
|
|
30
|
|
|
/** @var integer Код процесса */ |
|
31
|
|
|
private $code; |
|
32
|
|
|
|
|
33
|
|
|
/** @var string Тип */ |
|
34
|
|
|
private $type; |
|
35
|
|
|
|
|
36
|
|
|
/** @var string|array Сообщение */ |
|
37
|
|
|
private $message; |
|
38
|
|
|
|
|
39
|
|
|
public function __construct($type = null, $message = null, $code = null) { |
|
40
|
|
|
$this->type = $type; |
|
41
|
|
|
$this->message = $message; |
|
42
|
|
|
$this->code = $code; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/* mutators */ |
|
46
|
|
|
|
|
47
|
|
|
public function getCode() { |
|
48
|
|
|
return $this->code; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function getType() { |
|
52
|
|
|
return $this->type; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function getMessage() { |
|
56
|
|
|
return $this->message; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function setCode($code) { |
|
60
|
|
|
$this->code = $code; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function setType($type) { |
|
64
|
|
|
$this->type = $type; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
public function setMessage($message) { |
|
68
|
|
|
$this->message = $message; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/* tools */ |
|
72
|
|
|
|
|
73
|
1 |
|
static public function create($type = null, $message = null, $code = null) { |
|
74
|
1 |
|
return new static($type, $message, $code); |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
1 |
|
public function toArray() { |
|
78
|
|
|
return [ |
|
79
|
1 |
|
'type' => $this->type, |
|
80
|
1 |
|
'message' => $this->message, |
|
81
|
1 |
|
'code' => $this->code, |
|
82
|
1 |
|
]; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
} |