1 | <?php declare(strict_types=1); |
||
29 | abstract class BaseWriter implements BaseWriterInterface |
||
30 | { |
||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $data; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | private $urlPrefix; |
||
40 | |||
41 | /** |
||
42 | * @var bool |
||
43 | */ |
||
44 | private $isDataAnArray; |
||
45 | |||
46 | /** |
||
47 | * Constructor. |
||
48 | */ |
||
49 | 85 | public function __construct() |
|
53 | |||
54 | /** |
||
55 | * @inheritdoc |
||
56 | */ |
||
57 | 23 | public function setDataAsArray(): BaseWriterInterface |
|
67 | |||
68 | /** |
||
69 | * @inheritdoc |
||
70 | */ |
||
71 | 83 | public function getDocument(): array |
|
75 | |||
76 | /** |
||
77 | * @inheritdoc |
||
78 | */ |
||
79 | 6 | public function setMeta($meta): BaseWriterInterface |
|
87 | |||
88 | /** |
||
89 | * @inheritdoc |
||
90 | */ |
||
91 | 2 | public function setJsonApiVersion(string $version): BaseWriterInterface |
|
97 | |||
98 | /** |
||
99 | * @inheritdoc |
||
100 | */ |
||
101 | 2 | public function setJsonApiMeta($meta): BaseWriterInterface |
|
109 | |||
110 | /** |
||
111 | * @inheritdoc |
||
112 | */ |
||
113 | 85 | public function setUrlPrefix(string $prefix): BaseWriterInterface |
|
119 | |||
120 | /** |
||
121 | * @inheritdoc |
||
122 | */ |
||
123 | 5 | public function setLinks(iterable $links): BaseWriterInterface |
|
136 | |||
137 | /** |
||
138 | * @inheritdoc |
||
139 | */ |
||
140 | 1 | public function setProfile(iterable $links): BaseWriterInterface |
|
153 | |||
154 | /** |
||
155 | * @return void |
||
156 | */ |
||
157 | 85 | protected function reset(): void |
|
163 | |||
164 | /** |
||
165 | * @return string |
||
166 | */ |
||
167 | 65 | protected function getUrlPrefix(): string |
|
171 | |||
172 | /** |
||
173 | * @param null|string $prefix |
||
174 | * @param iterable $links |
||
175 | * |
||
176 | * @return array |
||
177 | */ |
||
178 | 67 | protected function getLinksRepresentation(?string $prefix, iterable $links): array |
|
190 | |||
191 | /** |
||
192 | * @param null|string $prefix |
||
193 | * @param iterable $links |
||
194 | * |
||
195 | * @return array |
||
196 | */ |
||
197 | 5 | protected function getLinksListRepresentation(?string $prefix, iterable $links): array |
|
209 | |||
210 | /** |
||
211 | * @return bool |
||
212 | */ |
||
213 | 67 | protected function isDataAnArray(): bool |
|
217 | } |
||
218 |