Raml\Validator\ValidatorSchemaHelper::getBody PHP Метод

getBody() приватный Метод

private getBody ( Raml\MessageSchemaInterface $schema, string $method, string $path, string $contentType ) : Raml\Body
$schema Raml\MessageSchemaInterface
$method string
$path string
$contentType string
Результат Raml\Body
    private function getBody(MessageSchemaInterface $schema, $method, $path, $contentType)
    {
        try {
            $body = $schema->getBodyByType($contentType);
        } catch (Exception $exception) {
            $message = sprintf('Schema for %s %s with content type %s was not found in API definition', strtoupper($method), $path, $contentType);
            throw new ValidatorSchemaException($message, 0, $exception);
        }
        // BodyInterface does not contain anything of use for validation, so we need to return an actual Body.
        if (!$body instanceof Body) {
            throw new ValidatorSchemaException(sprintf('Schema for %s %s with content type %s is BodyInterface but not a Body object, so we can\'t use it', strtoupper($method), $path, $contentType));
        }
        return $body;
    }