Run

@param  string $name
@return string - Название файла Миграции
185918
public function run($name)
    {
        $fileName = sprintf('%s_%s.sql',
            date('Ymd_His'),
            trim($name)
        );
        $migration = new Migration(null, $fileName);
        $migration->setSql(Migration::TAG_TRANSACTION . PHP_EOL
            . Migration::TAG_UP . PHP_EOL
            . PHP_EOL
            . Migration::TAG_DOWN . PHP_EOL
            . PHP_EOL
        );
        $this->repository->insert($migration);

        return $fileName;
    }
138495
public function runApi($name = 'api') {

		$router = Router::getInstance();

		// check if API has been called
		if (!trim($name) or $name != $router->module or !file_exists(MODULE_PATH . 'controller.php')) {
			return;
		}
		
		// set as raw request
		Router::setRaw();
		
		$logger = Logger::getInstance();
		$logger->disable();

		// require controller file
		require (MODULE_PATH . 'controller.php');
		
		// get SID by both GET and POST
		$sid = Input::get('sid');
		
		// get token as well
		$tokenValue = Router::get('token');

		$ctlName = $name . 'Controller';
		$apiCtl = new $ctlName();

		// set the action function
		$action = $router->action ? $router->action . 'Action' : 'defaultAction';
		
		// check token as first
		if ($tokenValue) {
			
			$token = Token::getByValue($tokenValue);
			
			// set token and start controller
			if ($token) {
				$token->updateLastUse();
				$apiCtl->setToken($token);
				$apiCtl->$action();
			} else {
				$apiCtl->sendError('Token is not valid');
			}
			
		// login and logout
		} else if ('login' == $router->action or 'logout' == $router->action) {
			
			// start the PHP session
			session_start();
			
			// start controller
			$apiCtl->$action();

		// all the other requests with sid
		} else if ($sid) {

			// get passed session
			$session = new Session($sid);

			// check if sid is valid
			if (!$session->isLoaded()) {
				$apiCtl->sendError('Session is not valid');
			}

			// if session exists, extend session timeout
			$session->extendTimeout();

			// create User object for API
			$userClass = PAIR_USER_CLASS;
			$user = new $userClass($session->idUser);
			$this->setCurrentUser($user);

			// set session and start controller
			$apiCtl->setSession($session);
			$apiCtl->$action();

		// unauthorized request
		} else {

			$apiCtl->sendError('Request is not valid');

		}

		exit();

	}
224127
protected function runGenerator($name, array $config, array $args)
    {
        echo $this->renderVersion();

        if (!isset($args[0])) {
            $this->usageError("You must specify a subject for what you are generating.");
        }

        list ($config['context'], $config['subject']) = strpos($args[0], ':') !== false
            ? explode(':', $args[0])
            : array('app', $args[0]);

        echo Line::begin('Running generator', Line::YELLOW)->nl();
        echo Line::begin()
            ->indent(2)
            ->text("Generating $name '{$args[0]}'.")
            ->nl(2);

        $generator = Generator::create($name, $config);

        if (!$generator->validate()) {
            $generator->renderErrors();
        }

        $files = $generator->generate();

        $this->save($files);
    }
613040
public function main(string $name = '')
    {
        parent::main();

        $path = Configure::readOrFail('CsvMigrations.modules.path');
        Utility::validatePath($path);

        $selection = $this->selection($path);
        $selection = $this->normalize($selection);
        $this->validate(implode('', $selection), $path);

        $this->bakeModuleConfig($selection, $path);
        $this->bakeDatabaseConfig($selection, $path);
    }
1174128
public function run($id)
    {
        $record = ORM::for_table('info_users')
            ->table_alias('iu')
            ->left_outer_join('users', ['u.id', '=', 'iu.user_id'], 'u')
            ->where_equal('iu.user_id', $id)
            ->where_null('iu.deleted_at')
            ->find_one();
        if (is_object($record)) {
            $record = $record->as_array();

            $record['id'] = $record['user_id'];

            if ($record['roles'] != '') {
                $record['roles'] = json_decode($record['roles'], true);
            } else {
                $record['roles'] = [];
            }

            return (new RunAfterGet($this->dic))->run($record);
        } else {
            return Response::error404('Пользователь не найден');
        }
    }
1080069
public function getGenerator($name)
    {
        if ($this->hasGenerator($name) === false) {
            throw new \RuntimeException(sprintf('Generator not found: "%s".', $name));
        }

        return $this->generators[$name];
    }
676024
public function runMacro($name, $args)
    {
        if (isset($this->macros[$name])) {
            if (is_callable($this->macros[$name])) {
                return call_user_func_array($this->macros[$name], array_merge([$this], $args));
            }
        }
    }
726464
public function sayHello($name)
    {
        /**
         * We use the 'storage' property to share data
         * between modules, this is a flash shared memory
         * so the data is wiped out at the end of the execution.
         */
        $this->storage->name = $name;

        /**
         * Also we can push messages to the message queue.
         */
        $this->messages->addMessage('Running module 1');

        /**
         * Finally perform custom sample code.
         */
        return "Hello, " . $name . " at " . $this->date->format('Y-m-d H:i:s');
    }
1120483
public function target($name)
    {
        if (!$this->config->hasTarget($name)) {
            throw new RuntimeException("The target named '$name' does not exist.");
        }
        $ext = $this->config->getExt($name);

        $themed = $this->config->isThemed($name);
        $filters = $this->config->targetFilters($name);
        $target = $this->config->cachePath($ext) . $name;

        $files = [];
        $scanner = $this->scanner($this->config->paths($ext, $name));
        $paths = $scanner->paths();

        $required = $this->config->requires($name);
        if ($required) {
            $compiler = $this->cachedCompiler();
            foreach ($required as $dependency) {
                $files[] = new Target($this->target($dependency), $compiler);
            }
        }

        foreach ($this->config->files($name) as $file) {
            if (preg_match('#^https?://#', $file)) {
                $files[] = new Remote($file);
            } else {
                if (preg_match('/(.*\/)(\*.*?)$/U', $file, $matches)) {
                    $path = $scanner->find($matches[1]);
                    if ($path === false) {
                        throw new RuntimeException("Could not locate folder $file for $name in any configured path.");
                    }
                    $glob = new Glob($path, $matches[2]);
                    $files = array_merge($files, $glob->files());
                } elseif (preg_match(static::CALLBACK_PATTERN, $file, $matches)) {
                    $callback = new Callback($matches[1], $matches[2], $scanner);
                    $files = array_merge($files, $callback->files());
                } else {
                    $path = $scanner->find($file);
                    if ($path === false) {
                        throw new RuntimeException("Could not locate $file for $name in any configured path.");
                    }
                    $files[] = new Local($path);
                }
            }
        }
        return new AssetTarget($target, $files, $filters, $paths, $themed);
    }
572958
protected function runOtherCommand($name, array $arguments = array())
	{
		$arguments['command'] = $name;
		$cleanup_command = $this->getApplication()->find($name);

		$input = new ArrayInput($arguments);

		return $cleanup_command->run($input, $this->io->getOutput());
	}
45743
public function get($name)
    {
        $value = NestedArrayUtil::getNestedArrayValue(self::$config, explode('.', $name), $exists);
        if (!$exists) {
            throw new \RuntimeException('Configuration not defined: ' . $name);
        }

        return $value;
    }
1353982
public static function run($name, $data = array(), $useMasterKey = false)
    {
        $sessionToken = null;
        if (AVUser::getCurrentUser())
        {
            $sessionToken = AVUser::getCurrentUser()->getSessionToken();
        }
        $response = AVClient::_request('POST', '/functions/' . $name, $sessionToken,
            json_encode(AVClient::_encode($data, null, false)), $useMasterKey);

        return AVClient::_decode($response['result']);
    }
1124428
public function callMacro(string $name, array $args)
    {
        if (isset($this->macros[$name])) {
            return call_user_func_array($this->macros[$name], $args);
        }
        throw new RuntimeException('There is no macro with the given name "'.$name.'" to call');
    }
1227671
public function get($name) {
        $this->runCopy();
        if (in_array($name, ['css', 'js', 'style', 'script'])) {
            $return = $this->{$name};
        } else {
            throw new \Exception(" '$name' doesn't Exists is the '" . __CLASS__ . "' class. ");
        }
        return $return;
    }
114278
public function run($name, AnCommandContext $context)
    {
        if ($this->_enabled) {
            $this->getStack()->push(clone $this);

            foreach ($this->getStack()->top() as $command) {
                if ($command->execute($name, $context) === $this->_break_condition) {
                    $this->getStack()->pop();
                    return $this->_break_condition;
                }
            }

            $this->getStack()->pop();
        }
    }
1160366
public static function factory($name)
    {
        if (!isset(self::$services[$name])) {
            throw new \RuntimeException("The service [$name] don't register.");
        }

        $service = self::$services[$name];

        if (\is_object($service) && method_exists($service, '__invoke')) {
            return $service();
        }

        return $service;
    }
478486
public function load($name)
    {
        if (!isset($this->templates[$name])) {
            $this->templates[$name] = $this->loadFile($name);
        }

        return $this->templates[$name];
    }