| @@ 80-90 (lines=11) @@ | ||
| 77 | /** |
|
| 78 | * {@inheritDoc} |
|
| 79 | */ |
|
| 80 | public function getDocument(State $state) |
|
| 81 | { |
|
| 82 | /** @var \Xabbuh\XApi\Model\DocumentData $documentData */ |
|
| 83 | $documentData = $this->doGetDocument('activities/state', array( |
|
| 84 | 'activityId' => $state->getActivity()->getId(), |
|
| 85 | 'agent' => $this->actorSerializer->serializeActor($state->getActor()), |
|
| 86 | 'stateId' => $state->getStateId(), |
|
| 87 | )); |
|
| 88 | ||
| 89 | return new StateDocument($state, $documentData); |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * Stores a state document. |
|
| @@ 98-111 (lines=14) @@ | ||
| 95 | * @param string $method HTTP method to use |
|
| 96 | * @param StateDocument $document The document to store |
|
| 97 | */ |
|
| 98 | private function doStoreStateDocument($method, StateDocument $document) |
|
| 99 | { |
|
| 100 | $state = $document->getState(); |
|
| 101 | $this->doStoreDocument( |
|
| 102 | $method, |
|
| 103 | 'activities/state', |
|
| 104 | array( |
|
| 105 | 'activityId' => $state->getActivity()->getId(), |
|
| 106 | 'agent' => $this->actorSerializer->serializeActor($state->getActor()), |
|
| 107 | 'stateId' => $state->getStateId(), |
|
| 108 | ), |
|
| 109 | $document |
|
| 110 | ); |
|
| 111 | } |
|
| 112 | } |
|
| 113 | ||