1: <?php
2: namespace Datadepo\Api;
3:
4: class DataDepoResponse
5: {
6:
7: const CODE_OK = 'ok';
8: const CODE_SUSPENDED = 'suspended';
9: const CODE_RUNNING = 'running';
10: const CODE_ERROR = 'error';
11:
12:
13: protected $code;
14:
15:
16: protected $message;
17:
18:
19: protected $counter;
20:
21: 22: 23:
24: public function __construct($code, $message = NULL, array $counter = NULL)
25: {
26: $this->code = $code;
27: $this->message = $message;
28: $this->counter = $counter;
29: }
30:
31: 32: 33:
34: public function toArray()
35: {
36: return array('code' => $this->code, 'message' => $this->message, 'counter' => $this->coounter);
37: }
38:
39: 40: 41:
42: public function toJson()
43: {
44: return json_encode($this->toArray());
45: }
46:
47: }