Your IP : 216.73.216.253


Current Path : /home/eolienneia/www/templates/yootheme/vendor/yootheme/graphql/lib/Type/Definition/
Upload File :
Current File : /home/eolienneia/www/templates/yootheme/vendor/yootheme/graphql/lib/Type/Definition/ListOfType.php

<?php
namespace YOOtheme\GraphQL\Type\Definition;

use YOOtheme\GraphQL\Error\InvariantViolation;
use YOOtheme\GraphQL\Utils\Utils;

/**
 * Class ListOfType
 * @package GraphQL\Type\Definition
 */
class ListOfType extends Type implements WrappingType, OutputType, InputType
{
    /**
     * @var ObjectType|InterfaceType|UnionType|ScalarType|InputObjectType|EnumType
     */
    public $ofType;

    /**
     * @param callable|Type $type
     */
    public function __construct($type)
    {
        $this->ofType = Type::assertType($type);
    }

    /**
     * @return string
     */
    public function toString()
    {
        $type = $this->ofType;
        $str = $type instanceof Type ? $type->toString() : (string) $type;
        return '[' . $str . ']';
    }

    /**
     * @param bool $recurse
     * @return ObjectType|InterfaceType|UnionType|ScalarType|InputObjectType|EnumType
     */
    public function getWrappedType($recurse = false)
    {
        $type = $this->ofType;
        return ($recurse && $type instanceof WrappingType) ? $type->getWrappedType($recurse) : $type;
    }
}