/**
  * @param ApiInterface $api
  * @return object
  */
 protected function locateRecord(ApiInterface $api)
 {
     $interpreter = $api->getRequestInterpreter();
     if (!($id = $interpreter->getResourceId())) {
         return null;
     }
     $store = $api->getStore();
     $identifier = ResourceIdentifier::create($interpreter->getResourceType(), $id);
     $record = $store->find($identifier);
     if (!$record) {
         throw new JsonApiException([], 404);
     }
     return $record;
 }
 /**
  * @param string $key
  * @param mixed $default
  * @return mixed
  */
 protected function get($key, $default = null)
 {
     $key = sprintf('paging-meta.%s', $key);
     return Arr::get($this->api->getOptions(), $key, $default);
 }
 /**
  * @inheritdoc
  */
 public function handle(ApiInterface $api, RequestInterface $request)
 {
     $interpreter = $api->getRequestInterpreter();
     $resourceType = $request->getResourceType();
     /** Check the relationship is acceptable */
     if ($request->getRelationshipName()) {
         $this->checkRelationshipName($request);
     }
     /** Check request parameters are acceptable */
     $this->checkQueryParameters($api, $request, $this->filterValidator($resourceType));
     /** Authorize the request */
     if ($this->authorizer) {
         $this->authorize($interpreter, $this->authorizer, $request);
     }
     /** Check the document content is acceptable */
     if ($this->validators) {
         $this->checkDocumentIsAcceptable($this->validators, $interpreter, $request);
     }
 }
 /**
  * @param HttpFactoryInterface $factory
  * @param EncodingParametersInterface $parameters
  * @param ApiInterface $api
  * @throws JsonApiException
  */
 private function checkEncodingParameters(HttpFactoryInterface $factory, EncodingParametersInterface $parameters, ApiInterface $api)
 {
     $checker = $factory->createQueryChecker($this->allowUnrecognizedParameters(), $this->allowedIncludePaths(), $this->allowedFieldSetTypes(), $this->allowedSortParameters(), $this->allowedPagingParameters($api->getPagingStrategy()), $this->allowedFilteringParameters());
     $checker->checkQuery($parameters);
 }