Initializes all the composer commands.
346346
protected function getDefaultCommands()
    {
        $commands = parent::getDefaultCommands();
        $commands[] = new Command\MetricsCommand();
        $commands[] = new Command\AddCommand();
        $commands[] = new Command\SortCommand();
        $commands[] = new Command\GuessCommand();

        return $commands;
    }
1115428
public function init()
    {
        $this->addCommand(Migration\CreateCommand::class);
        $this->addCommand(Migration\StatusCommand::class);
        $this->addCommand(Migration\MigrateCommand::class);
        $this->addCommand(Migration\ResetCommand::class);
        $this->addCommand(Migration\DropAllCommand::class);

        $this->addGlobalOption('d')
            ->alias('dir')
            ->description('Set migration file directory.');

        $this->addGlobalOption('p')
            ->alias('package')
            ->description('Package to run migration.');
    }
218057
public function initialize()
    {
        if (true == $this->initialized) {
            return;
        }

        $this->initialized = true;
        
        if ($this->isEnabled()) {
            $headScript = $this->getView()->plugin('headScript');
            
            $headScript->prependFile($this->src);
            
            $options = array();
            foreach (array('async', 'parseOnLoad') as $property) {
                if (null !== $this->$property) {
                    $options[$property] = $this->$property;
                }
            }
            if (!empty($this->packages)) {
                $options['packages'] = array_values($this->packages);
            }
            if (!empty($options)) {
                $headScript->prependScript("dojoConfig=" . json_encode($options) . ";");
            }
            if (!empty($this->modules)) {
                $require = 'require(["' . implode('", "', $this->modules) . '"]);';
                $headScript->appendScript($require);
            }
        }
    }
1208377
private function run_initializers()
    {
        $method_name = 'init';
        $cn = get_called_class();
        
        # Run ApplicationController's init method.
        if ($inits = $this->getAppControllersMethod($method_name)) {
            foreach ($inits as $init) {
                $init = $init->bindTo($this);
                $init();
            }
        }
        
        $method = $this->selfRefl->getMethod($method_name);
        if ($method->getDeclaringClass()->getName() == $cn) {
            $this->$method_name();
        }
    }
82779
public static function Initialize()
    {
        // Initialize the plugin loader and try to load any plugins.
        self::$plugin_loader = new Plugins\Loader();

        if(self::ValidExtension())
        {
            self::$plugin_loader->Start(self::GetCwd() . "/plugins");
            
            if(file_exists(self::GetCwd() . "/peg.conf"))
            {
                Settings::SetBackEnd(new Config\INI);
                Settings::Load(self::GetCwd(), "peg.conf");
            }
            else
            {
                Settings::SetBackEnd(new Config\JSON);
                Settings::Load(self::GetCwd(), "peg.json");
            }
        }
    }
1275974
protected function registerCommands()
    {
        if ($this->app->runningInConsole()) {
            $this->commands([
                ModulesCommand::class,
                ModelsCommand::class,
                EnumsCommand::class,
                RequestsCommand::class,
                MakeModuleCommand::class,
                VersionCommand::class
            ]);
        }
    }
170398
public function main()
    {
        if ($this->composer === null) {
            $this->findComposer();
        }

        $files = array();
        if (!empty($this->file) && file_exists($this->file)) {
            $files[] = $this->file;
        }

        if (!empty($this->dir)) {
            $found = $this->findFiles();
            foreach ($found as $file) {
                $files[] = $this->dir . DIRECTORY_SEPARATOR . $file;
            }
        }

        foreach ($files as $file) {

            $cmd = $this->composer . ' validate ' . $file;
            $cmd = escapeshellcmd($cmd);

            if ($this->passthru) {
                $retval = null;
                passthru($cmd, $retval);
                if ($retval == 1) {
                    throw new BuildException('invalid composer.json');
                }
            } else {
                $out = array();
                $retval = null;
                exec($cmd, $out, $retval);
                if ($retval == 1) {
                    $err = join("\n", $out);
                    throw new BuildException($err);
                } else {
                    $this->log($out[0]);
                }
            }

        }

    }
327166
public function init() {
		if(!Director::is_cli() && !Director::isDev() && !Permission::check('ADMIN')) {
			return Security::permissionFailure();
		}

		parent::init();
	}
597020
protected function configure(): void
    {
        $this->setName('dependency-guard');
        $this->setDescription(
            'Check Composer dependencies for a --no-dev install.'
        );

        $this->addOption(
            'format',
            'f',
            InputOption::VALUE_REQUIRED,
            'The output format. '
                . implode(
                    ', ',
                    array_map(
                        function (string $format) : string {
                            return sprintf('<comment>%s</comment>', $format);
                        },
                        $this->exporterFactory->getOutputFormats()
                    )
                ),
            ViolationExporterFactoryInterface::DEFAULT_FORMAT
        );
    }
791771
protected function initializeResouces()
    {
        if ($this->resources !== null) {
            return;
        }

        $this->resources = array();

        $contents = dir($this->root . $this->path);
        while (($path = $contents->read()) !== false) {
            if (in_array($path, array('.', '..', '.hg'))) {
                continue;
            }

            $this->resources[] = (is_dir($this->root . $this->path . $path) ?
                new \Arbit\VCSWrapper\HgCli\Directory($this->root, $this->path . $path . '/') :
                new \Arbit\VCSWrapper\HgCli\File($this->root, $this->path . $path)
            );
        }

        $contents->close();
    }
833543
protected function registerConsoleCommands()
    {
        $this->commands(AssetCommand::class);
        $this->commands(ThemeCommand::class);
        $this->commands(InstallCommand::class);
        $this->commands(GenerateDocumentationCommand::class);
    }
472116
protected function initialiseCommands()
    {
        $modules = $this->kernel->getModules();

        foreach ($modules as $module) {
            if ( ! $module instanceof ConsoleModuleInterface) {
                continue;
            }

            $module->registerCommands($this);
        }
    }
805249
private function initializeRepos()
    {
        $composer = $this->getComposer(false);

        if ($composer) {
            return array(
                $composer->getRepositoryManager()->getLocalRepository(),
                new CompositeRepository($composer->getRepositoryManager()->getRepositories())
            );
        }

        $defaultRepos = Factory::createDefaultRepositories($this->getIO());

        return array(new CompositeRepository($defaultRepos));
    }
1301259
protected function prepareExecute()
    {
        if (class_exists(ComposerInformation::class)) {
            $this->version = ComposerInformation::getInstalledVersion('windwalker/core');
        }

        if ($this->getRootCommand()->getOption('n')) {
            IOFactory::getIO()->setInput(new NullInput());
        }
    }
75240
public function init()
    {
        $this->addConsoleCommands();
        $this->getConsole()->add(new WorkerCommand($this));
        $this->getConsole()->add($this['init_command']);
        $this->getConsole()->add(new SshCommand($this));
        $this->getConsole()->add(new RunCommand($this));
        $this->getConsole()->add(new DebugCommand($this));
        $this->getConsole()->add(new AutocompleteCommand());
        $this->getConsole()->afterRun([$this, 'collectAnonymousStats']);
    }
1295140
protected function init()
	{
	    // language load lang
	    Ioc::language()->setLocale(Config::get('lang'));
	    Ioc::language()->load('common');
	    
	    // errorHandler register
	    Ioc::errorHandler()->register();
	    
	    if ($components = Config::get('components')) {
	        foreach ($components as $key => $def) {
	            Ioc::container()->setShared($key, $def);
	        }
	    }
	}
735847
protected function _init() {
		parent::_init();
		$this->request = $this->_config['request'];

		if (!is_object($this->request) || !$this->request->params) {
			return;
		}
		$default = ['command' => null, 'action' => null, 'args' => null];
		$params = array_diff_key((array) $this->request->params, $default);

		foreach ($params as $key => $param) {
			$this->{$key} = $param;
		}
		$this->response = $this->_config['response'];

		if (!is_object($this->response)) {
			$this->response = $this->_instance('response', $this->response + [
				'plain' => $this->plain
			]);
		}
	}