Joli\Jane\OpenApi\Generator\Parameter\BodyParameterGenerator::getClass PHP Method

getClass() protected method

protected getClass ( Joli\Jane\OpenApi\Model\BodyParameter $parameter, Joli\Jane\Generator\Context\Context $context ) : array
$parameter Joli\Jane\OpenApi\Model\BodyParameter
$context Joli\Jane\Generator\Context\Context
return array
    protected function getClass(BodyParameter $parameter, Context $context)
    {
        $resolvedSchema = null;
        $array = false;
        $schema = $parameter->getSchema();
        if ($schema instanceof Reference) {
            $resolvedSchema = $this->resolver->resolve($schema);
        }
        if ($schema instanceof Schema && $schema->getType() == "array" && $schema->getItems() instanceof Reference) {
            $resolvedSchema = $this->resolver->resolve($schema->getItems());
            $array = true;
        }
        if ($resolvedSchema === null) {
            return [$schema->getType(), null];
        }
        $class = $context->getObjectClassMap()[spl_object_hash($resolvedSchema)];
        $class = "\\" . $context->getNamespace() . "\\Model\\" . $class->getName();
        if ($array) {
            $class .= "[]";
        }
        return [$class, $array];
    }