create the migration template

@param string $name
@param array $params
@return string
551624
private function migrate($name, $params = [])
    {
        $generator = new TemplateGenerator();
        $generator->setContent(file_get_contents($name));

        return $generator->generate($params);
    }
490603
public static function callExtension($name, array $params = [])
    {
        $extension = static::getExtension($name);

        // call_user_func_array seems to be slow
        switch (count($params)) {
            case 0:
                return call_user_func($extension);
            case 1:
                return call_user_func($extension, $params[0]);
            case 2:
                return call_user_func($extension, $params[0], $params[1]);
            case 3:
                return call_user_func($extension, $params[0], $params[1], $params[2]);
            case 4:
                return call_user_func($extension, $params[0], $params[1], $params[2], $params[3]);
            default:
                return call_user_func_array($extension, $params);
        }
    }
1011709
private static function getTemplate(string $template, array $params): string
    {
        if (empty($template)) {
            return '';
        }
        $names   = array_keys($params);
        $replace = array_values($params);
        $search  = array_map(function ($v) {
            return sprintf('{%s}', $v);
        }, $names);

        return str_replace($search, $replace, $template);
    }
658553
public function create(string $name, array $params = array())
    {
        if (empty($name)) {
            throw new FactoryException ('create() requires a non-empty form name as first argument');
        }

        $className = $this->getFactoryNamespace() . '\\' . $name . $this->getFactoryPostfix();

        if (!class_exists($className)) {
            throw new FactoryException ('Form class "' . $className . '" does not exist');
        }

        $result = $this->createFormInstance($className, $params);

        return $result;
    }
512136
private function create_project_migration($name) {
		$name = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $name);

		$datetime = date('Ymd_His');
		$filename = $datetime . '_' . strtolower($name) . '.php';
		$classname = 'Migration_' . $datetime . '_' . ucfirst($name);

		$template = file_get_contents(__DIR__ . '/../template/migration.php');
		$template = str_replace('%%namespace%%', '', $template);
		$template = str_replace('%%classname%%', $classname, $template);
		file_put_contents(\Skeleton\Database\Migration\Config::$migration_directory . '/' . $filename, $template);
		return \Skeleton\Database\Migration\Config::$migration_directory . '/' . $filename;
	}
1320992
public function create(array $params = [])
    {
        return $this->executeRequest(
            RequestMethodEnum::POST,
            ResourceMethodEnum::CREATE,
            $params,
            null
        );
    }
749721
public function handle($name, array $params = [])
    {
        $model = $params[0];
        $form  = $params[1];
        $form->extend(function(FormGrid $grid) use($model) {
            $grid->fieldset('api_configuration', function (Fieldset $fieldset) use($model) {
                $fieldset->legend(trans('antares/api::labels.api_configuration'));
                $control = $fieldset->control('checkbox', 'enabled')
                        ->label(trans('antares/api::labels.api_enabled'))
                        ->value(1);
                $apiRole = ApiRoles::where(['role_id' => $model->id])->first();

                if (!is_null($apiRole) and $apiRole->enabled) {
                    $control->attributes(['checked' => 'checked']);
                }
            });
        });
    }
683638
public function create($name)
    {
        $this->checkName($name);

        $configuration = new Configuration();

        $configuration->setName($name);

        $configuration->setModel($this->getParameter($name, 'model'));
        $configuration->setForm($this->getParameter($name, 'form'));
        $configuration->setFormTemplate($this->getParameter($name, 'template.form'));
        $configuration->setRecipientTemplate($this->getParameter($name, 'template.recipient'));
        $configuration->setRecipient($this->getParameter($name, 'recipient'));
        $configuration->setConfirmTemplate($this->getParameter($name, 'template.confirm'));
        $configuration->setPageTemplate($this->getParameter($name, 'template.page'));
        $configuration->setFrom($this->getParameter($name, 'from'));
        $configuration->setSenderName($this->getParameter($name, 'sender_name'));
        $configuration->setSubject($this->getParameter($name, 'subject'));
        $configuration->setTranslationDomain($this->getParameter($name, 'translation_domain'));
        $configuration->setConfirmMail($this->getParameter($name, 'confirm_mail'));

        return $configuration;
    }
308595
public function makeMigration($name)
  {
    $m = $this->getManager();
    $t = $m->getPrefix() . $this->getTable();

    $class = StaticStringy::upperCamelize($name);

    $head = "<?php\n\n"
      . "use Phinx\\Migration\\AbstractMigration;\n\n"
      . "class $class extends AbstractMigration\n"
      . "{\n";

    $pk       = $this->getPrimaryKey();
    $tbl_opts = 'array(\'id\' => ' . ($pk ? "'$pk'" : 'false') . ')';

    $tbl  = '    $tbl = $this->table(\'' . $t . '\', ' . $tbl_opts . ');' . "\n";
    $save = '    $tbl->save();' . "\n";
    $up   = $down = false;

    $drop = $upd = false;

    $tbl_exists = $this->checkTableExists();
    if ($tbl_exists) {
      $columns = $this->getActualColumns(true);

      $drop = array_diff($columns, array_keys($this->columns));
      $add  = array_diff(array_keys($this->columns), $columns);
    } else {
      $down = '    $tbl->drop();' . "\n";
      $add  = array_keys($this->columns);
    }

    if (!empty($add)) {
      foreach ($add as $col) {
        $up .= $this->makeAddExpr($col);
        if ($tbl_exists) {
          $down .= $this->makeDropExpr($col);
        }
      }
    }

    if (!empty($drop)) {
      foreach ($drop as $col) {
        if ($col != $this->getPrimaryKey()) {
          $up .= $this->makeDropExpr($col);
          $down .= "    // TODO: добавить инструкции для создания столбца $col\n";
        }
      }
    }

    foreach ($this->columns as $col => $arr) {
      if (empty($add) || !in_array($col, $add)) {
        $up .= $this->makeAddExpr($col, true);
      }
    }

    if (!empty($this->indexes)) {
      foreach ($this->indexes as $a) {
        $up .= $this->makeAddIndex($a, $tbl_exists);
      }
    }

    if (!empty($this->foreign_keys)) {
      foreach ($this->foreign_keys as $arr) {
        $up .= $this->makeFK($arr, $tbl_exists);
      }
    }

    return $head
    . "  public function up()\n"
    . "  {\n" . $tbl . $up . $save
    . "  }\n\n"
    . "  public function down()\n"
    . "  {\n" . $tbl . $down . ($tbl_exists ? $save : '')
    . "  }\n"
    . "}\n";
  }
1162549
protected function create(Array $arguments=[])
	{
		$migrationsDirectory = $this->cmd->getConfigOpt('migrations_storage');
		$templateTags = [];

		$migrationName = $this->cmd->question('Migration filename?');
		$filename = trim($migrationName);

		$path = $migrationsDirectory . '/' . $filename . '.php';

		if (file_exists($path)) {
			throw new MigrationFileInvalidException(
				sprintf(
					'Migration file [%s] exists.',
					$filename
				)
			);
		}

		$templateTags['phx:class'] = Helper::getQualifiedClassName($filename);

		$builder = new TemplateBuilder($this->cmd, $this->env);
		$builder->createClassTemplate('migration', $filename, $migrationsDirectory, $templateTags);

		// After migration class has been created, the record needs to go to the database and be set to pending.
		$model = new Model();
		$model->class_name = $templateTags['phx:class'];
		$model->status = Attribute::STATUS_PENDING;
		$model->path = $path;
		$model->save();

		$this->env->sendOutput('Created migration is now pending', 'green');
	}
549973
public function generateUrl(string $name, array $parameters = []): string
    {
        $definition = $this->provider->getRouteDefinitionByName($name);
        return $definition->formatUrl($parameters);
    }
35449
public function generate($name, $params = []) {
		$url = '';
		$path = $this->generatePath($name, $params);

		if ($path) {
			if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])
				&& $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'
			) {
				$scheme = 'https';
			} else {
				$scheme = 'http';
			}
			$url = $scheme . '://' . $_SERVER['HTTP_HOST'] . $path;
		}

		return $url;
	}
376383
public function create($name, $extension = null, $table = null, $create = false)
    {
        $migrationPath = $this->getMigrationPath($extension);

        $path = $this->getPath($name, $migrationPath);

        $stub = $this->getStub($table, $create);

        $this->files->put($path, $this->populateStub($stub, $table));

        return $path;
    }
1093292
public function create(array $params = [])
    {
        $defaults = [
            'name' => null,
            'identifier' => null,
            'description' => null,
        ];
        $params = $this->sanitizeParams($defaults, $params);

        if (
            !isset($params['name'])
         || !isset($params['identifier'])
        ) {
            throw new \Exception('Missing mandatory parameters');
        }

        $xml = $this->prepareParamsXml($params);

        return $this->post('/projects.xml', $xml->asXML());
    }
1037347
public static function URL($name, $params = []){
      return ($r = static::tagged($name)) ? $r-> getURL($params) : new URL();
    }
450880
public function render($name, $params = [])
    {
        if (isset($this->fullQualifiedPathNameWithTemplatePath[$name])) {
            $template   = $this->getNewTemplate();
            $path       = $this->fullQualifiedPathNameWithTemplatePath[$name];

            $template->setFilePath($path->getPath() . '.phtml');

            if ($this->defaultParametersProvided) {
                $template->assignMany($this->defaultParameters);
            }

            if (isset($this->fullQualifiedPathNameWithDefaultParameters[$name])) {
                $template->assignMany($this->fullQualifiedPathNameWithDefaultParameters[$name]);
            }

            if (!empty($params)) {
                $template->assignMany($params);
            }

            $content = $template->render();
        } else {
            $content = '';
        }

        return $content;
    }
287260
public function template($name, array $params = []): ResponseInterface
    {
        if (\is_array($name)) {
            $params = $name;
            $name = null;
        }

        if ($name === null) {
            $handler = $this->app->handler();
            if ($handler instanceof \Closure) {
                throw new \LogicException('Con not build the template from closure handler!');
            }

            $name = \ltrim($handler['app'] . '/' . $handler['controller'] . '/' . $handler['action'], '/');
        } elseif (!\is_string($name)) {
            throw new \InvalidArgumentException('Template name not found!');
        }

        $response = $this->response();

        return $this->app->render($response, $name, $params);
    }