Register application provider
Workaround for BC break in https://github.com/laravel/framework/pull/25028
@param string $providerName
@param bool $force
512
protected function appRegister($providerName, $force = false)
    {
        if (!$this->appRegisterParameters) {
            $method = new \ReflectionMethod(get_class($this->app), 'register');
            $this->appRegisterParameters = count($method->getParameters());
        }

        if ($this->appRegisterParameters == 3) {
            $this->app->register($providerName, [], $force);
        } else {
            $this->app->register($providerName, $force);
        }
    }
689553
public function getActiveServices(bool $force = false) : CNabuMessagingServiceList
    {
        if ($this->nb_messaging_service_list->isEmpty() || $force) {
            $this->nb_messaging_service_list->clear();
            if (($nb_messaging = $this->getMessaging()) instanceof CNabuMessaging &&
                !($nb_services_list = $nb_messaging->getActiveServices())->isEmpty()
            ) {
                $nb_services_list->iterate(function($key, CNabuMessagingService $nb_service) {
                    if ($nb_service->isTemplateConnected($this->getId())) {
                        $this->nb_messaging_service_list->addItem($nb_service);
                    }
                    return true;
                });
            }
        }

        return $this->nb_messaging_service_list;
    }
388587
public static function registerIconFontSet($fontName, $forceCopyAssets = false)
    {
        if (!in_array($fontName, static::getAvailableIconFontSets())) {
            return false;
        }

        $fontPath = \Yii::getPathOfAlias('foundation.fonts.foundation_icons_' . $fontName);
        $fontUrl  = \Yii::app()->assetManager->publish($fontPath, true, -1, $forceCopyAssets);

        \Yii::app()->clientScript->registerCssFile($fontUrl . "/stylesheets/{$fontName}_foundicons.css");

        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7.0')) {
            \Yii::app()->clientScript->registerCssFile($fontUrl . "/stylesheets/{$fontName}_foundicons_ie7.css");
        }
    }
1102758
public function registerProvidersFor($binding)
    {
        foreach ($this->provides($binding) as $provider) {
            $this->registerProvider($provider, true, $binding);
        }
    }
475889
protected function getHttpClient(bool $force = false): HttpClient
    {
        if ($this->_httpClient === null || $force) {
            $config = ArrayHelper::merge(['class' => HttpClient::class], $this->httpClientConfig);
            $config['baseUrl'] = $this->getBaseUrl();

            return $this->_httpClient = Yii::createObject($config);
        } else {
            return $this->_httpClient;
        }
    }
1156505
public function save(string $filename, bool $force_download = false)
    {
        $basename  = pathinfo($filename, PATHINFO_BASENAME);
        $extension = pathinfo($filename, PATHINFO_EXTENSION);

        $factory = null;
        foreach($this->writers as $slug => $writer) {

            if ($extension == $slug && $slug == 'pdf') {
                IOFactory::registerWriter('CustomPDF', PDFWriter::class);
                $factory = IOFactory::createWriter($this->getSpreadsheet(), 'CustomPDF');

            } elseif ($extension == $slug && in_array($slug, ['html', 'htm']) == true) {
                IOFactory::registerWriter('CustomHtml', HtmlWriter::class);
                $factory = IOFactory::createWriter($this->getSpreadsheet(), 'CustomHtml');

            } elseif ($extension == $slug) {
                $factory = IOFactory::createWriter($this->getSpreadsheet(), $writer);
            }
        }

        if ($factory == null) {
            throw new \InvalidArgumentException(
                "Unsupported file type for writing. Use " . implode(',', $this->writers));
        }

        if ($force_download == true) {
            $this->httpHeaders($basename, $extension);
            $factory->save('php://output');
        } else {
            $factory->save($filename);
        }
    }
1066534
public function forceSwitch($dbHost, $dbName, $dbUser, $dbPassword, array $dbOptions = array())
    {
        if ($this->getSession()->has(self::SESSION_CONNECTION_KEY)) {
            $current = $this->getSession()->get(self::SESSION_CONNECTION_KEY);
            if ($current[self::PARAM_HOST] === $dbHost && $current[self::PARAM_DATABASE] === $dbName) {
                return false;
            }
        }

        $this->getSession()->set(self::SESSION_CONNECTION_KEY, array(
            self::PARAM_DRIVER_OPTIONS => $dbOptions,
            self::PARAM_HOST           => $dbHost,
            self::PARAM_DATABASE       => $dbName,
            self::PARAM_USER           => $dbUser,
            self::PARAM_PASSWORD       => $dbPassword,
        ));

        if ($this->isConnected()) {
            $this->close();
        }

        return true;
    }
515929
public static function loadConfiguration($force = false)
    {
        if ($force === false && static::$isConfigurationLoaded === true)
        {
            return true;
        }

        if (class_exists('\Bitrix\Main\Config\Configuration'))
        {
            $config = Configuration::getInstance()->get('monolog');

            if (is_array($config) && !empty($config))
            {
                Cascade::fileConfig($config);

                return true;
            }
        }

        return false;
    }
488161
public function register($provider)
    {
        if (! $provider instanceof ServiceProvider) {
            $provider = new $provider($this);
        }

        if (array_key_exists($providerName = get_class($provider), $this->loadedProviders)) {
            return;
        }

        $this->loadedProviders[$providerName] = true;

        if (method_exists($provider, 'register')) {
            $provider->register();
        }

        if (method_exists($provider, 'boot')) {
            return $this->call([$provider, 'boot']);
        }
    }
1074881
public void registerServices(boolean force) {
		Injector injector = Guice.createInjector(getGuiceModule());
		injector.injectMembers(this);
		registerInRegistry(force);
	}
638388
public function delete($force = false)
    {
        $this->getParent()->serverGroupDelete($this->getId(), $force);

        unset($this);
    }
974955
public function delete($name, $force = false)
    {
        $arg = ($force === true) ? '-D' : '-d';
        $this->clearAll();
        $this->addCommandName(self::BRANCH_COMMAND);
        $this->addCommandArgument($arg);
        $this->addCommandSubject($name);

        return $this->getCommand();
    }
1290962
public function make($name, $force = FALSE) {
        if (isset($this->singles[$name])) {
            return $this->singles[$name];
        }
        #获得实现提供者
        $closure = $this->getClosure($name);
        #获取实例
        $object = $this->build($closure, $name);
        #单例绑定
        if (isset($this->bindings[$name]['force']) && $this->bindings[$name]['force'] || $force) {
            $this->singles[$name] = $object;
        }
        return $object;
    }
423286
public function refresh(bool $force = false, bool $cascade = false) : bool
    {
        $this->relinkDB();
        return $this->load();
    }
1255106
public function registerProvider($provider){
        $providers = (array) $provider;

        foreach($providers as $provider){
            $this->app()['config']->add('general.providers', $provider);
        }
    }
225960
public static function load($force = false) 
    {
        // already loaded
        if (!$force && self::$_loaded) {
            return false;
        }
        self::_resolveDefaultPath();

        $files = glob(realpath(self::$_path)."/*.php");
        foreach ($files as $file) {
            Log::log("loading factory from $file ...");
            include_once $file;
        }
        self::$_loaded = true;
        return self::$_loaded;
    }
25239
public function delete($force = false)
    {
        $this->getParent()->channelDelete($this->getId(), $force);

        unset($this);
    }