1 | <?php |
||
19 | abstract class AbstractDocument implements DocumentInterface |
||
20 | { |
||
21 | /** |
||
22 | * default fields |
||
23 | * @const array DEFAULT_FIELDS |
||
24 | */ |
||
25 | const DEFAULT_FIELDS = ['createdAt', 'size', 'offset']; |
||
26 | |||
27 | /** |
||
28 | * created at |
||
29 | * @param int $createdAt |
||
30 | */ |
||
31 | protected $createdAt = null; |
||
32 | |||
33 | /** |
||
34 | * size |
||
35 | * @param int $size |
||
36 | */ |
||
37 | protected $size = null; |
||
38 | |||
39 | /** |
||
40 | * offset |
||
41 | * @param string $offset |
||
42 | */ |
||
43 | protected $offset = null; |
||
44 | |||
45 | /** |
||
46 | * get fields |
||
47 | * |
||
48 | * @return array |
||
49 | */ |
||
50 | abstract protected function getFields(): array; |
||
51 | |||
52 | /** |
||
53 | * set created at |
||
54 | * |
||
55 | * @param int $createdAt |
||
56 | * |
||
57 | * @return this |
||
58 | */ |
||
59 | 9 | public function setCreatedAt(int $createdAt) |
|
65 | |||
66 | /** |
||
67 | * get created at |
||
68 | * |
||
69 | * @return int |
||
70 | */ |
||
71 | 9 | public function getCreatedAt(): int |
|
75 | |||
76 | /** |
||
77 | * set size |
||
78 | * |
||
79 | * @param int $size |
||
80 | * |
||
81 | * @return this |
||
82 | */ |
||
83 | 9 | public function setSize(int $size) |
|
89 | |||
90 | /** |
||
91 | * get size |
||
92 | * |
||
93 | * @return int |
||
94 | */ |
||
95 | 9 | public function getSize(): int |
|
99 | |||
100 | /** |
||
101 | * set offset |
||
102 | * |
||
103 | * @param string $offset |
||
104 | * |
||
105 | * @return this |
||
106 | */ |
||
107 | 9 | public function setOffset(string $offset) |
|
113 | |||
114 | /** |
||
115 | * get offset |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | 9 | public function getOffset(): string |
|
123 | |||
124 | /** |
||
125 | * to json |
||
126 | * |
||
127 | * @return string |
||
128 | */ |
||
129 | 9 | public function toJson(): string |
|
133 | |||
134 | /** |
||
135 | * to query string |
||
136 | * |
||
137 | * @return string |
||
138 | */ |
||
139 | 9 | public function toQueryString(): string |
|
143 | |||
144 | /** |
||
145 | * to request parameters |
||
146 | * |
||
147 | * @return array |
||
148 | */ |
||
149 | 16 | protected function toRequestParameters(): array |
|
161 | |||
162 | /** |
||
163 | * to snake case |
||
164 | * |
||
165 | * @param string $string |
||
166 | * |
||
167 | * @return string |
||
168 | */ |
||
169 | 16 | protected function toSnakeCase(string $string): string |
|
173 | } |
||
174 |