WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface::createQueryParamUnrecognizedException PHP Method

createQueryParamUnrecognizedException() public method

public createQueryParamUnrecognizedException ( WoohooLabs\Yin\JsonApi\Request\RequestInterface $request, string $queryParamName ) : Exception
$request WoohooLabs\Yin\JsonApi\Request\RequestInterface
$queryParamName string
return Exception
    public function createQueryParamUnrecognizedException(RequestInterface $request, $queryParamName);

Usage Example

示例#1
0
 /**
  * @throws \WoohooLabs\Yin\JsonApi\Exception\QueryParamUnrecognized
  */
 public function validateQueryParams()
 {
     foreach ($this->getQueryParams() as $queryParamName => $queryParamValue) {
         if (preg_match("/^([a-z]+)\$/", $queryParamName) && in_array($queryParamName, ["fields", "include", "sort", "page", "filter"]) === false) {
             throw $this->exceptionFactory->createQueryParamUnrecognizedException($this, $queryParamName);
         }
     }
 }