Creating form

@param string|null $type
@return array
@throws \ReflectionException
968560
public function createForm(string $type = null): array
    {
        $data = [
            'storageUrl' => $this->getStorageUrl($type),
            'buttons' => $this->getButtons($type),
            'structure' => $this->getStructure($type),
        ];

        if ($this->multiLanguage) {
            $data['languages'] = $this->getContentLanguages();
        }

        return $data;
    }
709049
public function makeAssets($type = null)
    {
        if ($type != null) {
            $type = strtolower($type);
        }
        $result = null;
        $reserved = ['build'];

        $this->removeDuplicates();

        if ($type == null || $type == 'css') {
            foreach ($this->assets['css'] as $asset) {

                /*
                 * Prevent duplicates
                 */
                $attributes = Html::attributes(array_merge(
                    [
                        'rel'  => 'stylesheet',
                        'href' => $this->getAssetEntryBuildPath($asset)
                    ],
                    array_except($asset['attributes'], $reserved)
                ));

                $result .= '<link' . $attributes . '>' . PHP_EOL;
            }
        }

        if ($type == null || $type == 'rss') {
            foreach ($this->assets['rss'] as $asset) {
                $attributes = Html::attributes(array_merge(
                    [
                        'rel'   => 'alternate',
                        'href'  => $this->getAssetEntryBuildPath($asset),
                        'title' => 'RSS',
                        'type'  => 'application/rss+xml'
                    ],
                    array_except($asset['attributes'], $reserved)
                ));

                $result .= '<link' . $attributes . '>' . PHP_EOL;
            }
        }

        if ($type == null || $type == 'js') {
            foreach ($this->assets['js'] as $asset) {
                $attributes = Html::attributes(array_merge(
                    [
                        'src' => $this->getAssetEntryBuildPath($asset)
                    ],
                    array_except($asset['attributes'], $reserved)
                ));

                $result .= '<script' . $attributes . '></script>' . PHP_EOL;
            }
        }

        return $result;
    }
568462
public function getForm($eloquent, $type = null)
    {
        $classname     = $eloquent->classname;
        $model         = $eloquent->contents->first();
        $configuration = [
            'content'       => $model !== null ? $model->content : null,
            'title'         => $model !== null ? $model->title : '',
            'type'          => $eloquent->exists ? $eloquent->type->name : '',
            'form_name'     => $eloquent->name
        ];
        $notification  = app($classname ?: Notification::class);

        $fluent        = new Fluent(array_merge($configuration, array_except($eloquent->toArray(), ['type'])));
        if (!is_null($fluent->type) && $type) {
            $fluent->type = $type;
        }

        return $this->form($fluent, $notification);
    }
28056
public function make(string $class = null, string $type = null, array $args = [])
    {
        $class = $class ?? $this->class ?? $this->resolveClassName($type);
        \assert('class_exists($class)');
        $reflection = new \ReflectionClass($class);
        if ($args !== [] && !\is_int(key($args))) {
            $args = $this->resolveConstructorArguments($args, $reflection);
        }
        return $reflection->newInstanceArgs($args);
    }
303029
public function create_form( $type ) {
		// Bail if installing.
		if ( isset( $_POST['option_page'] ) && 'github_updater_install' === $_POST['option_page'] ) {
			return;
		}

		$this->register_settings( $type ); ?>
		<form method="post">
			<?php
			settings_fields( 'github_updater_install' );
			do_settings_sections( 'github_updater_install_' . $type );
			if ( 'plugin' === $type ) {
				submit_button( esc_html__( 'Install Plugin', 'github-updater' ) );
			}
			if ( 'theme' === $type ) {
				submit_button( esc_html__( 'Install Theme', 'github-updater' ) );
			}
			?>
		</form>
		<?php
	}
775042
public function copy($type = null)
    {
        $builder = new Builder($this->type, $this->dogmatist, $this->parent, $this->strict);
        $this->copyData($builder);

        if ($type !== null) {
            $builder->setType($type);
        }

        return $builder;
    }
1303156
public function instance($type = null, $options = array())
	{
		$type = $type ?: $this->getType();

		$signature = serialize(array($type, $options));

		// If the given type has not been created before, we will create the instances
		// here and cache it so we can return it next time very quickly. If there is
		// already a type created by this name, we'll just return that instance.
		if (!isset($this->types[$signature]))
		{
			try
			{
				$document = $this->createType($type, $options);
			}
			catch (Exception $e)
			{
				$document = $this->createType('html', $options);
			}

			$this->types[$signature] = $document;
		}

		return $this->types[$signature];
	}
462634
public static function getInject($type = null) {
        if ($type === null)
            return static::$inject;
        elseif (isset(static::$inject[$type]))
            return static::$inject[$type];

        return array();
    }
1015183
public static function create($name, $type = NULL, $defaultValue = self::UNDEFINED, $modifiers = self::MODIFIER_PROTECTED) {
    if (isset($type)) {
      if ($type instanceof GClass) {
        $type = new ObjectType(new GClass($type->getFQN()));
      } elseif (!($type instanceof Type)) {
        $type = Type::create($type);
      }
    }
    
    return new static($name, $type, $defaultValue, $modifiers);
  }
1073689
public function type($type = null)
    {
        if (is_null($type)) {
            return $this->type;
        }

        $this->type = $type;

        return $this;
    }
261665
public function getForm($type)
    {
        $arguments = array();
        switch (strtolower($type)) {
            case 'config':
                $class = 'Config';
                $arguments[] = $this->getService();
                break;
            case 'advanced':
                $class = 'AdvancedConfig';
                $arguments[] = $this->getService();
                break;
            case 'batch':
                $class = 'Batch';
                $arguments[] = $this->getInvoiceManager();
                break;
            case 'invoice':
                $class = 'InvoiceStatusOverview';
                $arguments[] = $this->getInvoiceManager();
                $arguments[] = $this->getAcumulusEntryManager();
                $arguments[] = $this->getService();
                break;
            default;
                throw new \InvalidArgumentException("Unknown form type $type");
        }
        $arguments = array_merge($arguments, array(
            $this->getFormHelper(),
            $this->getShopCapabilities(),
            $this->getConfig(),
            $this->getTranslator(),
            $this->getLog(),
        ));
        /** @noinspection PhpIncompatibleReturnTypeInspection */
        return $this->getInstance($class . 'Form', 'Shop', $arguments);
    }
923016
public static function get($type = null) {
        return is_null($type) ? self::$_messages : (isset(self::$_messages[$type]) ? self::$_messages[$type] : []);
    }
1164741
public function getNewFile($type = null)
    {
        $class = $this->getFileModelName($type);
        /** @var ModelFile $file */
        $file = new $class();
        $file->setModel($this);
        $file->setFilesystem($this->getFilesystemDisk());
        return $file;
    }
128804
public function create()
    {
        $class = $this->getClass();
        $form = new $class();

        $schema = $this->schemaManager->create();
        $schema->setObjectClass($this->postManager->getClass());

        $form->setSchema($schema);

        return $form;
    }
550645
protected function createFormGroup(array $data = null)
    {
        if (isset($data['type'])) {
            $type = $data['type'];
        } else {
            $type = $this->defaultGroupType();
        }

        $group = $this->formGroupFactory()->create($type);
        $group->setForm($this->formWidget());

        if ($data !== null) {
            $group->setData($data);
        }

        return $group;
    }
604442
public function all($type = null)
    {
        return array_filter(
            $this->bag,
            /** @var BuilderInterface $builder */
            function (BuilderInterface $builder) use ($type) {
                return $type === null || $builder->getType() == $type;
            }
        );
    }
379074
public function make( $type )
    {
        $type = __NAMESPACE__ . "\\" . $type;
        if (class_exists( $type )) {
            /**
             * @var \Lti\Seo\Generators\Thing $object
             */
            $object = new $type( $this->helper );
            $result = $object->format();
            if (is_array( $result ) && ! empty( $result )) {
                return json_encode( array_merge( array( '@context' => 'http://schema.org' ), $result ) );
            }
        }

        return null;
    }