getBodyByType() public method

Get the body by type
public getBodyByType ( string $type ) : raml\BodyInterface
$type string
return raml\BodyInterface
 /**
  * @param MessageSchemaInterface $schema
  * @param string $method
  * @param string $path
  * @param string $contentType
  * @return Body
  * @throws ValidatorSchemaException
  */
 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;
 }