1 | <?php |
||
19 | abstract class AbstractDocument implements DocumentInterface |
||
20 | { |
||
21 | /** |
||
22 | * default fields |
||
23 | * @const array DEFAULT_FIELDS |
||
24 | */ |
||
25 | const DEFAULT_FIELDS = ['createdAt']; |
||
26 | |||
27 | /** |
||
28 | * created at |
||
29 | * @param int $createdAt |
||
30 | */ |
||
31 | protected $createdAt = null; |
||
32 | |||
33 | /** |
||
34 | * get fields |
||
35 | * |
||
36 | * @return array |
||
37 | */ |
||
38 | abstract protected function getFields(): array; |
||
39 | |||
40 | /** |
||
41 | * set created at |
||
42 | * |
||
43 | * @param int $createdAt |
||
44 | * |
||
45 | * @return this |
||
46 | */ |
||
47 | 9 | public function setCreatedAt($createdAt) |
|
53 | |||
54 | /** |
||
55 | * get created at |
||
56 | * |
||
57 | * @return int |
||
58 | */ |
||
59 | 9 | public function getCreatedAt(): int |
|
63 | |||
64 | /** |
||
65 | * to json |
||
66 | * |
||
67 | * @return string |
||
68 | */ |
||
69 | 9 | public function toJson(): string |
|
73 | |||
74 | /** |
||
75 | * to query string |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | 9 | public function toQueryString(): string |
|
83 | |||
84 | /** |
||
85 | * to request parameters |
||
86 | * |
||
87 | * @return array |
||
88 | */ |
||
89 | 16 | protected function toRequestParameters(): array |
|
101 | |||
102 | /** |
||
103 | * to snake case |
||
104 | * |
||
105 | * @param string $string |
||
106 | * |
||
107 | * @return string |
||
108 | */ |
||
109 | 16 | protected function toSnakeCase(string $string): string |
|
113 | } |
||
114 |