public function toArray(Manager $manager = null)
    {
        $typeValue = null;
        $type = $this->type;
        if (!$type instanceof Type) {
            if (!$manager) {
                throw new InvalidArgumentException(sprintf(
                    'Custom type %s provided, but no %s instance was given to %s',
                    $type,
                    Manager::class,
                    __CLASS__
                ));
            }
            $type = $manager->getType($type);
        }

        $args = [
            'description' => $this->description,
            'type' => $this->required ? Type::nonNull($type) : $type,
        ];

        if ($this->defaultValue !== null) {
            $args['defaultValue'] = $this->defaultValue;
        }

        return $args;
    }
public function toArray(Manager $manager = null)
    {
        $typeValue = null;
        $type = $this->type;
        if (!$type instanceof Type) {
            if (!$manager) {
                throw new InvalidArgumentException(sprintf(
                    'Custom type %s provided, but no %s instance was given to %s',
                    $type,
                    Manager::class,
                    __CLASS__
                ));
            }
            $type = $manager->getType($type);
        }

        $args = [
            'description' => $this->description,
            'type' => $this->required ? Type::nonNull($type) : $type,
        ];

        if ($this->defaultValue !== null) {
            $args['defaultValue'] = $this->defaultValue;
        }

        return $args;
    }
public function toArray ( Manager $ manager = null ) { $ typeValue = null ; $ type = $ this -> type ; if ( ! $ type instanceof Type ) { if ( ! $ manager ) { throw new InvalidArgumentException ( sprintf ( 'Custom type %s provided, but no %s instance was given to %s' , $ type , Manager :: class , __CLASS__ ) ) ; } $ type = $ manager -> getType ( $ type ) ; } $ args = [ 'description' => $ this -> description , 'type' => $ this -> required ? Type :: nonNull ( $ type ) : $ type , ] ; if ( $ this -> defaultValue !== null ) { $ args [ 'defaultValue' ] = $ this -> defaultValue ; } return $ args ; }
Creates an array suitable for a map of args in a field
@param Manager $manager
@return array
Creates an array suitable for a map of args in a field