1 | <?php |
||
24 | abstract class DocumentApiClient |
||
25 | { |
||
26 | private $requestHandler; |
||
27 | private $version; |
||
28 | private $documentDataSerializer; |
||
29 | |||
30 | /** |
||
31 | * @param HandlerInterface $requestHandler The HTTP request handler |
||
32 | * @param string $version The xAPI version |
||
33 | * @param DocumentDataSerializerInterface $documentDataSerializer The document data serializer |
||
34 | */ |
||
35 | 12 | public function __construct(HandlerInterface $requestHandler, $version, DocumentDataSerializerInterface $documentDataSerializer) |
|
41 | |||
42 | /** |
||
43 | * Stores a document. |
||
44 | * |
||
45 | * @param string $method HTTP method to use |
||
46 | * @param string $uri Endpoint URI |
||
47 | * @param array $urlParameters URL parameters |
||
48 | * @param Document $document The document to store |
||
49 | */ |
||
50 | 6 | protected function doStoreDocument($method, $uri, $urlParameters, Document $document) |
|
60 | |||
61 | /** |
||
62 | * Deletes a document. |
||
63 | * |
||
64 | * @param string $uri The endpoint URI |
||
65 | * @param array $urlParameters The URL parameters |
||
66 | */ |
||
67 | 3 | protected function doDeleteDocument($uri, array $urlParameters) |
|
72 | |||
73 | /** |
||
74 | * Returns a document. |
||
75 | * |
||
76 | * @param string $uri The endpoint URI |
||
77 | * @param array $urlParameters The URL parameters |
||
78 | * |
||
79 | * @return Document The document |
||
80 | */ |
||
81 | 3 | protected function doGetDocument($uri, array $urlParameters) |
|
89 | |||
90 | /** |
||
91 | * Deserializes the data of a document. |
||
92 | * |
||
93 | * @param string $data The serialized document data |
||
94 | * |
||
95 | * @return DocumentData The parsed document data |
||
96 | */ |
||
97 | 3 | protected function deserializeDocument($data) |
|
101 | } |
||
102 |