1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace Khansia\Generic;
class Result extends Objects {
const CODE_SUCCESS = 0;
const INFO_SUCCESS = 'OK';
public function __construct($guid = 0, $code = self::CODE_SUCCESS, $info = self::INFO_SUCCESS) {
parent::__construct(
array(
'guid' => $guid,
'code' => $code,
'info' => $info,
'data' => null,
),
array(
'guid',
'code',
'info',
'data',
)
);
}
public function clear() {
$this->guid = 0;
$this->code = self::CODE_SUCCESS;
$this->info = self::INFO_SUCCESS;
}
public function toArray() {
return $this->pull();
}
public function toJson() {
return json_encode($this->toArray());
}
}