1 | <?php |
||
9 | class Data extends \ArrayObject |
||
10 | { |
||
11 | /** |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $message; |
||
15 | |||
16 | /** |
||
17 | * @param string $message |
||
18 | * @param array $data |
||
19 | */ |
||
20 | public function __construct($message = '', $data = []) |
||
25 | |||
26 | /** |
||
27 | * @return array |
||
28 | */ |
||
29 | public function getData() |
||
33 | |||
34 | /** |
||
35 | * @return string |
||
36 | */ |
||
37 | public function getMessage() |
||
41 | |||
42 | /** |
||
43 | * @param string message |
||
44 | */ |
||
45 | public function setMessage($message) |
||
49 | |||
50 | /** |
||
51 | * Merge another result into this result. Data already |
||
52 | * existing in this result takes precedence over the |
||
53 | * data in the Result being merged. |
||
54 | * |
||
55 | * @param \Robo\ResultData $result |
||
56 | * |
||
57 | * @return $this |
||
58 | */ |
||
59 | public function merge(Data $result) |
||
65 | |||
66 | /** |
||
67 | * Update the current data with the data provided in the parameter. |
||
68 | * Provided data takes precedence. |
||
69 | * |
||
70 | * @param \ArrayObject $update |
||
71 | * |
||
72 | * @return $this |
||
73 | */ |
||
74 | public function update(\ArrayObject $update) |
||
85 | |||
86 | /** |
||
87 | * Merge another result into this result. Data already |
||
88 | * existing in this result takes precedence over the |
||
89 | * data in the Result being merged. |
||
90 | * |
||
91 | * $data['message'] is handled specially, and is appended |
||
92 | * to $this->message if set. |
||
93 | * |
||
94 | * @param array $data |
||
95 | * |
||
96 | * @return array |
||
97 | */ |
||
98 | public function mergeData(array $data) |
||
104 | |||
105 | /** |
||
106 | * @return bool |
||
107 | */ |
||
108 | public function hasExecutionTime() |
||
112 | |||
113 | /** |
||
114 | * @return null|float |
||
115 | */ |
||
116 | public function getExecutionTime() |
||
123 | |||
124 | /** |
||
125 | * Accumulate execution time |
||
126 | */ |
||
127 | public function accumulateExecutionTime($duration) |
||
136 | |||
137 | /** |
||
138 | * Accumulate the message. |
||
139 | */ |
||
140 | public function accumulateMessage($message) |
||
148 | } |
||
149 |