wol-soft/php-json-schema-model-generator

View on GitHub
src/Model/Property/PropertyType.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

declare(strict_types=1);

namespace PHPModelGenerator\Model\Property;

class PropertyType
{
    /** @var string */
    private $name;
    /** @var bool|null */
    private $nullable;

    /**
     * PropertyType constructor.
     *
     * @param string $name        The name of the type (eg. 'array', 'int', ...)
     * @param bool|null $nullable Is the property nullable? if not provided the nullability will be determined
     *                            automatically from the required flag/implicitNull setting etc.
     */
    public function __construct(string $name, ?bool $nullable = null)
    {
        $this->name     = $name;
        $this->nullable = $nullable;
    }

    /**
     * @return string
     */
    public function getName(): string
    {
        return $this->name;
    }

    /**
     * @return bool|null
     */
    public function isNullable(): ?bool
    {
        return $this->nullable;
    }
}