createResourceTypeMissingException() 공개 메소드

public createResourceTypeMissingException ( ) : Exception
리턴 Exception
예제 #1
0
 /**
  * @param array $data
  * @param \WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory
  * @throws \Exception
  */
 protected function validateType($data, ExceptionFactoryInterface $exceptionFactory)
 {
     if (empty($data["type"])) {
         throw $exceptionFactory->createResourceTypeMissingException();
     }
     $acceptedType = $this->getAcceptedType();
     if (is_string($acceptedType) === true && $data["type"] !== $acceptedType) {
         throw $exceptionFactory->createResourceTypeUnacceptableException($data["type"], [$acceptedType]);
     }
     if (is_array($acceptedType) && in_array($data["type"], $acceptedType) === false) {
         throw $exceptionFactory->createResourceTypeUnacceptableException($data["type"], $acceptedType);
     }
 }