Auto generate migration name
@param string $name Migration name
@return mixed|string
491712
public function getMigrationName($name = '') {
        $name = $name ? : $this->prefix . $this->tableNameRaw;

        $components = Yii::$app->getComponents();
        if (isset($components['session'])) {
            Yii::$app->session->set($this->tableName, '');
        }
        $this->migrationName= $this->migrationName ? : 'm' . gmdate('ymd_His') . '_' . $name;

        $name = $this->saveTblNameInSession($this->migrationName);

        return $name;
    }
1195433
protected function name($name = null)
    {
        $filename = is_null($name) ? $this->filename() : $name;

        $hash = Hash::make($filename);

        $name = $hash;
        //
        $this->templateFile = $name;
        //
        return $name;
    }
322734
public function getTableName($name)
    {
        $tableName = null;
        if (isset($this->app['schema.tables'][$name])) {
            /** @var BaseTable $table */
            $table = $this->app['schema.tables'][$name];
            $tableName = $table->getTableName();
        }

        return $tableName;
    }
1296897
public function rename($name)
    {
        $newPath = sys_get_temp_dir() . "/$name";
        $ret = rename($this->path(), $newPath);
        $this->path = $newPath;

        return $ret;
    }
967871
public function getIdResourceByName(string $name): string
    {
        if (isset($this->resource[$name])) {
            return (string) $this->resource[$name]['id'];
        }
        return '';
    }
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";
  }
30968
protected function getAlterMigrationName($name, $count)
    {
        $filename = sprintf('%s_alter_%s_table_%s.php', date('Y_m_d_His'), strtolower($name), $count);

        return Helpers::postFixWith($filename, '.php');
    }
381839
protected function getMigrationFile($name, $path = false)
    {
        $path = $path ? $path : $this->migrationPath;
        return $path . DIRECTORY_SEPARATOR . $name . '.php';
    }
1373860
public function name( $name = null )
	{
		if ( is_null( $name ) )
		{
			return $this->_instance_name;
		}
		
		$this->_instance_name = $name;
	}
137197
protected function get_namefor($name = '') {
        $name = $name !== '' ? '_' . $name : '';
        return $this->plugintype . '_' . $this->pluginname . $name;
    }
642751
public function rename($name)
    {
        return $this->client->apiCall('groups.rename', [
            'channel' => $this->getId(),
            'name' => $name,
        ])->then(function () use ($name) {
            $this->data['name'] = $name;
            return $name;
        });
    }
1356447
public function getUniqueName($name)
    {
        if (!isset($this->registry[$name])) {
            $this->registry[$name] = 0;

            return $name;
        }

        ++$this->registry[$name];

        return sprintf('%s_%s', $name, $this->registry[$name]);
    }
1232830
protected function translateName($name)
    {
        if ($name === '/index.php') {
            return '';
        }

        $name = ltrim($name, '/');
        $name = rtrim($name, '/');

        return preg_replace('/[^A-Za-z0-9\-_]/', '', strtr($name, [
            '/' => '_',
            '.md' => '',
        ]));
    }
149294
protected function parseMigrationName($name)
    {
        // create_users_table
        // add_user_id_to_posts_table
        // create_post_tag_table
        $pieces = explode('_', $name);

        // This is the action that the user
        // wants to take. Create or Delete or Add.
        $action = array_shift($pieces);

        // Adding _table to the migration name is optional
        if (end($pieces) == 'table') array_pop($pieces);

        // Next, we need to determine what the table name is.
        // This is tough, because it could be something like
        // posts, or posts_tags. Further, the migration name could
        // be 'create_posts_tags_table', or 'add_post_id_to_posts_tags_table'
        // So we'll search for the keywords 'to' or 'from'.
        $divider = array_search('to', $pieces);
        if ($divider === false) $divider = array_search('from', $pieces);

        // If we did find one of those "to" or "from" connecting words,
        // we know that what follows is the table name.
        $tableName = ($divider !== false)
            ? implode('_', array_slice($pieces, $divider + 1))
            : implode('_', $pieces);

        // For example: ['add', 'posts']
        return array($action, $tableName);
    }
173283
public static function createMigration(string $name): void
    {
        $directory = Application::getApplicationPath('migrations');

        if (!is_dir($directory)) {
            Directory::mkdir($directory, 0755);
        }

        $timestamp = time();
        $className = Util::camelCase($name, null, false);
        $phpClassName = "Migration_{$timestamp}_{$className}";
        $fileName = "{$timestamp}_{$className}.php";
        $fullPath = Application::getApplicationPath("migrations/{$fileName}");

        $migrationFileContent = file_get_contents(__DIR__ . '/MigrationTemplate.php');
        $migrationFileContent = str_replace('templateClassName', $phpClassName, $migrationFileContent);
        $migrationFileContent = str_replace('templateClassGenerated', date('r'), $migrationFileContent);

        if (file_put_contents($fullPath, $migrationFileContent) === false) {
            throw new Application\Exception("Unable to write to migration file on path={$fullPath}");
        }

        Log::info("Created DB migration with name: {$name}");
        Log::info("You may now open application/migrations/{$fileName} and add your migration code");
    }
362342
public function buildSourceTableMigration($name)
    {
        $path = $this->getMigrationPath($name);
        $migration = $this->getTableMigrationName($name);

        $contents = view('_hierarchy::migrations.table', [
            'table'     => source_table_name($name),
            'migration' => $migration
        ])->render();

        $this->write($path, $contents);

        return $this->getMigrationClassPath($migration);
    }
1036347
public function name($name = null)
    {
        if ($name !== null) {
            $this->config('name', $name);
        }

        return $this->config('name');
    }