Controllers\xAPI\DocumentController::store PHP Method

store() public method

Creates (POSTs) a new document.
public store ( ) : Response
return Response
    public function store()
    {
        // Runs filters.
        if ($result = $this->checkVersion()) {
            return $result;
        }
        // Checks and gets the data from the params.
        $data = $this->getShowData();
        // Gets the content from the request.
        $data['content_info'] = $this->getAttachedContent('content');
        $data['ifMatch'] = \LockerRequest::header('If-Match');
        $data['ifNoneMatch'] = \LockerRequest::header('If-None-Match');
        $data['ifMatch'] = isset($data['ifMatch']) ? trim($data['ifMatch'], '"') : null;
        $data['ifNoneMatch'] = isset($data['ifNoneMatch']) ? trim($data['ifNoneMatch'], '"') : null;
        // Stores the document.
        $document = $this->document->store($this->getOptions(), $this->document_type, $data, $this->getUpdatedValue(), $this->method);
        if ($document) {
            return \Response::json(null, BaseController::NO_CONTENT, ['ETag' => '"' . $document->sha . '"']);
        } else {
            throw new Exceptions\Exception('Could not store Document.');
        }
    }