@param Type $type

@return MethodGenerator
@throws \Zend\Code\Generator\Exception\InvalidArgumentException
339909
private function assembleConstructor(Type $type): MethodGenerator
    {
        $body = [];
        $constructor = MethodGenerator::fromArray([
            'name' => '__construct',
            'visibility' => MethodGenerator::VISIBILITY_PUBLIC,
        ]);
        $docblock = DocBlockGeneratorFactory::fromArray([
            'shortdescription' => 'Constructor'
        ]);

        foreach ($type->getProperties() as $property) {
            $body[] = sprintf('$this->%1$s = $%1$s;', $property->getName());
            $withTypeHints = $this->options->useTypeHints() ? ['type' => $property->getType()] : [];

            $constructor->setParameter(array_merge([
                'name' => $property->getName(),
            ], $withTypeHints));

            if ($this->options->useDocBlocks()) {
                $docblock->setTag([
                    'name' => 'var',
                    'description' => sprintf('%s $%s', $property->getType(), $property->getName())
                ]);
            }
        }

        if ($this->options->useDocBlocks()) {
            $constructor->setDocBlock($docblock);
        }

        $constructor->setBody(implode($constructor::LINE_FEED, $body));

        return $constructor;
    }
1324830
public function getLoader($type, $locale)
    {
        switch ($type) {
            case 'yaml':
                return $this->newLoaderYaml($locale);
            case 'php':
                return $this->newLoaderPHP($locale);
        }
        throw new \InvalidArgumentException("Unknown loader type '$type'.");
    }
1298576
public function setOutputType($type)
    {
        if (preg_match('/(png|gif|jpe?g|tif?f|webp)/i', $type)) {
            $this->resource->setImageFormat($type);
        } else {
            throw new \InvalidArgumentException(sprintf('Invalid output format %s', $type));
        }
    }
350862
public static function get(string $type): AbstractReader
    {
        if (!\array_key_exists($type, static::$invokableClasses)) {
            throw new InvalidArgumentException('Unsupported config file type: '.$type);
        }

        return new static::$invokableClasses[$type];
    }
210361
public function generate($type)
    {
        return function ($row, $control, $templates = []) use ($type) {
            $data = $this->buildFieldByType($type, $row, $control);
            return $this->render($templates, $data);
        };
    }
708281
public function getConfiguredBuilder(Table $table, $type)
    {
        $class = $this->getConfigProperty('generator.objectModel.builders.' . $type);

        if (null === $class) {
            throw new InvalidArgumentException("Invalid data model builder type `$type`");
        }

        $builder = new $class($table);
        $builder->setGeneratorConfig($this);

        return $builder;
    }
782409
public function setTypeHandler($type, TypeHandler $typeHandler) {
		if (!is_string($type) || empty($type))
			throw new \InvalidArgumentException("Type must be defined as a string");	
		$this->typeHandlers[$type] = $typeHandler;
	}
1156860
protected function getLoader($type)
    {
        if (!isset($this->loaders[$type])) {
            throw new \InvalidArgumentException("No loader defined for type '${type}'.");
        }

        return $this->loaders[$type];
    }
1313969
public function setType(string $type): self
    {
        if (!\in_array($type, self::COLUMN_TYPES, true)) {
            throw new \InvalidArgumentException('Not supported column type '. $type);
        }

        $this->type = $type;

        return $this;
    }
920298
protected function generate($type)
    {
        $slug = $this->data['slug'];

        if ($type == 'module') {
            $path = $this->getModulePath($slug);
        } else if ($type == 'theme') {
            $path = $this->getThemePath($slug);
        } else {
            $path = $this->getPackagePath($slug);
        }

        if ($this->files->exists($path)) {
            $this->error('The Package [' .$slug .'] already exists!');

            return false;
        }

        $steps = array(
            'Generating folders...'          => 'generateFolders',
            'Generating files...'            => 'generateFiles',
            'Generating .gitkeep ...'        => 'generateGitkeep',
            'Updating the composer.json ...' => 'updateComposerJson',
        );

        $progress = new ProgressBar($this->output, count($steps));

        $progress->start();

        foreach ($steps as $message => $method) {
            $progress->setMessage($message);

            call_user_func(array($this, $method), $type);

            $progress->advance();
        }

        $progress->finish();

        $this->info("\nGenerating optimized class loader");

        $this->container['composer']->dumpOptimized();

        $this->info("Package generated successfully.");
    }
41521
public function setExportHandler($type)
    {
        if (
            $type === self::EXPORT_NORMAL ||
            $type === self::EXPORT_ARRAY ||
            $type === self::EXPORT_SKIP ||
            is_callable($type)
        ) {
            $this->exportHandler = $type;
            return $this;
        }

        throw new InvalidArgumentException(
            "invalid value provided for 'type'; ".
            "expecting a callable, or one of the following contstants: ".
            "sndsgd\Field::EXPORT_NORMAL, sndsgd\Field::EXPORT_ARRAY, or ".
            "sndsgd\Field::EXPORT_SKIP"
        );
    }
1036428
public function create($type)
    {
        if (!is_string($type) && !($type instanceof LdapObjectSchema)) {
            throw new InvalidArgumentException(
                'You must either pass the schema object type as a string to this method, or pass the schema types '
                . 'LdapObjectSchema to this method.'
            );
        }
        if (!($type instanceof LdapObjectSchema)) {
            $type = $this->schemaFactory->get($this->connection->getConfig()->getSchemaName(), $type);
        }
        $this->schema = $type;
        $this->container = $type->getDefaultContainer();

        return $this;
    }
1370070
public function loadRenderer($type)
	{
		$class = __NAMESPACE__ . '\\Type\\' . ucfirst($this->_type) . '\\' . ucfirst($type);

		if (!class_exists($class))
		{
			throw new \InvalidArgumentException(\Lang::txt('Unable to load renderer class'), 500);
		}

		return new $class($this);
	}
795336
private function getConverter(TypeInterface $type)
    {
        $type = (string) $type->getType();

        if (!isset($this->converters[$type])) {
            throw new \InvalidArgumentException(sprintf('The converter for type "%s" could not be found.', $type));
        }

        return $this->converters[$type];
    }
632324
public function getHandlerFor(string $type)
    {
        if (empty($this->handlers[$type])) {
            throw new \InvalidArgumentException('There is no handler for the "'.$type.'" criteria type.');
        } elseif (is_object($this->handlers[$type]) && $this->handlers[$type] instanceof CriteriaHandler) {
            return $this->handlers[$type];
        }

        return new $this->handlers[$type];
    }
468607
public function invoke($type, $parameters = null)
    {
        $class = $this->getClass($type);
        $name  = $this->normalizeType($type);

        $params = func_get_args();
        array_shift($params);

        $reflector = new \ReflectionClass($class);
        $instance  = $reflector->newInstanceArgs($params);

        if (empty($params)) {
            parent::__set($name, $instance);
        }

        return (clone $instance);
    }
1364765
public function addType($type)
    {
        if ($type instanceof Type) {
            $type = $type->getName();
        }

        if (!\is_string($type)) {
            throw new InvalidException('Invalid type type');
        }

        $this->_types[] = $type;

        return $this;
    }