1 | <?php |
||
10 | class Data extends \ArrayObject |
||
11 | { |
||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $message; |
||
16 | |||
17 | /** |
||
18 | * @param string $message |
||
19 | * @param array $data |
||
20 | */ |
||
21 | public function __construct($message = '', $data = []) |
||
26 | |||
27 | /** |
||
28 | * @return array |
||
29 | */ |
||
30 | public function getData() |
||
34 | |||
35 | /** |
||
36 | * @return string |
||
37 | */ |
||
38 | public function getMessage() |
||
42 | |||
43 | /** |
||
44 | * @param string $message |
||
45 | */ |
||
46 | public function setMessage($message) |
||
50 | |||
51 | /** |
||
52 | * Merge another result into this result. Data already |
||
53 | * existing in this result takes precedence over the |
||
54 | * data in the Result being merged. |
||
55 | * |
||
56 | * @param \Robo\State\Data $result |
||
57 | * |
||
58 | * @return $this |
||
59 | */ |
||
60 | public function merge(Data $result) |
||
66 | |||
67 | /** |
||
68 | * Update the current data with the data provided in the parameter. |
||
69 | * Provided data takes precedence. |
||
70 | * |
||
71 | * @param \ArrayObject $update |
||
72 | * |
||
73 | * @return $this |
||
74 | */ |
||
75 | public function update(\ArrayObject $update) |
||
86 | |||
87 | /** |
||
88 | * Merge another result into this result. Data already |
||
89 | * existing in this result takes precedence over the |
||
90 | * data in the Result being merged. |
||
91 | * |
||
92 | * $data['message'] is handled specially, and is appended |
||
93 | * to $this->message if set. |
||
94 | * |
||
95 | * @param array $data |
||
96 | * |
||
97 | * @return array |
||
98 | */ |
||
99 | public function mergeData(array $data) |
||
105 | |||
106 | /** |
||
107 | * @return bool |
||
108 | */ |
||
109 | public function hasExecutionTime() |
||
113 | |||
114 | /** |
||
115 | * @return null|float |
||
116 | */ |
||
117 | public function getExecutionTime() |
||
124 | |||
125 | /** |
||
126 | * Accumulate execution time |
||
127 | * |
||
128 | * @param array|float $duration |
||
129 | * |
||
130 | * @return null|float |
||
131 | */ |
||
132 | public function accumulateExecutionTime($duration) |
||
141 | |||
142 | /** |
||
143 | * Accumulate the message. |
||
144 | * |
||
145 | * @param string $message |
||
146 | * |
||
147 | * @return string |
||
148 | */ |
||
149 | public function accumulateMessage($message) |
||
157 | } |
||
158 |