1 | <?php |
||
12 | abstract class BaseResource implements \Iterator |
||
13 | { |
||
14 | /** |
||
15 | * BaseResource constructor. |
||
16 | * |
||
17 | * @param object $descriptor |
||
18 | * @param null|string $basePath |
||
19 | * |
||
20 | * @throws ResourceValidationFailedException |
||
21 | */ |
||
22 | public function __construct($descriptor, $basePath, $skipValidations = false) |
||
34 | |||
35 | public static function handlesDescriptor($descriptor) |
||
39 | |||
40 | public function read($options = null) |
||
49 | |||
50 | public function dataStreams() |
||
65 | |||
66 | /** |
||
67 | * @return object |
||
68 | */ |
||
69 | public function descriptor() |
||
73 | |||
74 | /** |
||
75 | * @return string |
||
76 | */ |
||
77 | public function name() |
||
81 | |||
82 | public function path() |
||
95 | |||
96 | public function data() |
||
100 | |||
101 | // standard iterator functions - to iterate over the data sources |
||
102 | public function rewind() |
||
110 | |||
111 | public function current() |
||
115 | |||
116 | public function key() |
||
120 | |||
121 | public function next() |
||
125 | |||
126 | public function valid() |
||
143 | |||
144 | public static function validateDataSource($dataSource, $basePath = null) |
||
157 | |||
158 | /** |
||
159 | * allows extending classes to add custom sources |
||
160 | * used by unit tests to add a mock http source. |
||
161 | * |
||
162 | * @param string $dataSource |
||
163 | * @param string $basePath |
||
164 | * |
||
165 | * @return string |
||
166 | */ |
||
167 | public static function normalizeDataSource($dataSource, $basePath = null) |
||
179 | |||
180 | protected $descriptor; |
||
181 | protected $basePath; |
||
182 | protected $skipValidations = false; |
||
183 | protected $currentDataPosition = 0; |
||
184 | protected $currentDataStream = 0; |
||
185 | protected $dataStreams = null; |
||
186 | |||
187 | protected function validateResource() |
||
191 | |||
192 | /** |
||
193 | * @param string $dataSource |
||
194 | * |
||
195 | * @return BaseDataStream |
||
196 | */ |
||
197 | abstract protected function getDataStream($dataSource); |
||
198 | |||
199 | abstract protected function getInlineDataStream($data); |
||
200 | |||
201 | protected static function handlesProfile($profile) |
||
205 | } |
||
206 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.