当前位置: 首页>>代码示例>>PHP>>正文


PHP ClassLoader::unregister方法代码示例

本文整理汇总了PHP中Composer\Autoload\ClassLoader::unregister方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassLoader::unregister方法的具体用法?PHP ClassLoader::unregister怎么用?PHP ClassLoader::unregister使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Composer\Autoload\ClassLoader的用法示例。


在下文中一共展示了ClassLoader::unregister方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __destruct

 public function __destruct()
 {
     if ($this->loader) {
         $this->loader->unregister();
         $this->loader = NULL;
     }
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:7,代码来源:ClassLoader.php

示例2: runCommand

 /**
  * Runa a command in and returns the commandTester object. This method can
  * run either a blend command or a sub-application command
  * @param string $projectFolder
  * @param string $commandName
  * @param string $params
  * @param string $app In case of null it will be set to blend. In case of
  * className as string, the application's class name will be used
  * @return CommandTester
  */
 public static function runCommand($projectFolder, $commandName, array $params = [], $app = null, $runOptions = [])
 {
     $loader = new ClassLoader();
     $curDir = getcwd();
     chdir($projectFolder);
     if ($app === null) {
         $app = new SetupApplication($projectFolder);
     } else {
         if (is_string($app)) {
             $classes = explode('\\', $app);
             $loader->addPsr4("{$classes[0]}\\", $projectFolder . '/src/');
             $loader->register(true);
             $c = new Container();
             $c->defineSingletonWithInterface('app', $app, ['scriptPath' => $projectFolder . '/bin']);
             $app = $c->get('app');
         }
     }
     $commandTester = new CommandTester($app->find($commandName));
     $commandTester->execute($params, $runOptions);
     chdir($curDir);
     $c = null;
     if ($loader) {
         $loader->unregister();
     }
     return $commandTester;
 }
开发者ID:blendsdk,项目名称:blendengine,代码行数:36,代码来源:ProjectUtil.php

示例3: build

 /**
  * Builds internal request handling objects.
  *
  * @return $this
  */
 public function build()
 {
     if ($this->cache) {
         $loader = new ClassLoader();
         if ($this->apc) {
             $apcLoader = new ApcClassLoader(sha1('ReactServer'), $loader);
             $loader->unregister();
             $apcLoader->register(true);
         }
     }
     require_once $this->root_dir . '/AppKernel.php';
     define('KERNEL_ROOT', $this->root_dir);
     $kernel = new ReactKernel($this->env, $this->env === 'dev' ? true : false);
     $this->loop = Factory::create();
     // TODO make config for this part
     if (class_exists('\\Doctrine\\DBAL\\Driver\\PingableConnection')) {
         $this->loop->addPeriodicTimer(15, function () use($kernel) {
             foreach ($kernel->getContainer()->get('doctrine')->getConnections() as $connection) {
                 if ($connection instanceof \Doctrine\DBAL\Driver\PingableConnection) {
                     $connection->ping();
                 }
             }
         });
     }
     $this->socket = new SocketServer($this->loop);
     $http = new HttpServer($this->socket, $this->loop);
     $http->on('request', $this->handleRequest($kernel));
     return $this;
 }
开发者ID:itscaro,项目名称:react-bundle,代码行数:34,代码来源:Server.php

示例4: activate

 static function activate(ClassLoader $loader)
 {
     self::$loader = $loader;
     self::$loader->unregister();
     self::$activated = [__CLASS__ => __CLASS__];
     self::$included = [__CLASS__ => __CLASS__];
     self::$error_reporting = error_reporting();
     // Регистрация метода-обработчика автозагрузки классов
     spl_autoload_register(['\\boolive\\core\\Core', 'loadClass'], true, true);
     // Регистрация метода-обработчка завершения выполнения системы
     register_shutdown_function(['\\boolive\\core\\Core', 'deactivate']);
     // Регистрация обработчика исключений
     set_exception_handler(['\\boolive\\core\\Core', 'exception']);
     // Регистрация обработчика ошибок
     set_error_handler(['\\boolive\\core\\Core', 'error']);
     // Временая зона
     date_default_timezone_set('UTC');
     // Настройка кодировки
     mb_internal_encoding('UTF-8');
     mb_regex_encoding('UTF-8');
     mb_http_output('UTF-8');
     // При необходимости, каждый класс может автоматически подключиться и активироваться, обработав событие Core::activate.
     \boolive\core\events\Events::trigger('Core::activate');
 }
开发者ID:boolive,项目名称:core,代码行数:24,代码来源:Core.php

示例5: testFindFile

 /**
  * @covers ::findFile
  */
 public function testFindFile()
 {
     $finder = new ClassFinder();
     // The full path is returned therefore only tests with
     // assertStringEndsWith() so the test is portable.
     $this->assertStringEndsWith('core/tests/Drupal/Tests/UnitTestCase.php', $finder->findFile(UnitTestCase::class));
     $class = 'Not\\A\\Class';
     $this->assertNull($finder->findFile($class));
     // Register an autoloader that can find this class.
     $loader = new ClassLoader();
     $loader->addClassMap([$class => __FILE__]);
     $loader->register();
     $this->assertEquals(__FILE__, $finder->findFile($class));
     // This shouldn't prevent us from finding the original file.
     $this->assertStringEndsWith('core/tests/Drupal/Tests/UnitTestCase.php', $finder->findFile(UnitTestCase::class));
     // Clean up the additional autoloader after the test.
     $loader->unregister();
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:21,代码来源:ClassFinderTest.php

示例6: build

 /**
  * Builds internal request handling objects.
  *
  * @return $this
  */
 public function build()
 {
     if ($this->cache) {
         $loader = new ClassLoader();
         if ($this->apc) {
             $apcLoader = new ApcClassLoader(sha1('ReactServer'), $loader);
             $loader->unregister();
             $apcLoader->register(true);
         }
     }
     require_once $this->root_dir . '/AppKernel.php';
     define('KERNEL_ROOT', $this->root_dir);
     $kernel = new ReactKernel($this->env, $this->env === 'dev' ? true : false);
     $this->loop = Factory::create();
     $this->socket = new SocketServer($this->loop);
     $http = new HttpServer($this->socket, $this->loop);
     $http->on('request', $this->handleRequest($kernel));
     return $this;
 }
开发者ID:pigi72333,项目名称:react-bundle,代码行数:24,代码来源:Server.php

示例7: run

 public static function run(ClassLoader $autoloader)
 {
     // Converts warnings to exceptions
     ErrorHandler::register();
     $config = self::loadConfig();
     if (isset($config['extension_autoloader']) && $config['extension_autoloader']) {
         $autoloadFile = $config['extension_autoloader'];
         if (!file_exists($autoloadFile)) {
             throw new \InvalidArgumentException(sprintf('Could not find extension autoload file "%s"', $autoloadFile));
         }
         $autoloader->unregister();
         include $autoloadFile;
         $autoloader->register(true);
     }
     $extensions = $config['extensions'];
     $extensions[] = 'PhpBench\\Extension\\CoreExtension';
     unset($config['extensions']);
     $container = new Container($extensions, $config);
     $container->init();
     $container->get('console.application')->run();
 }
开发者ID:dantleech,项目名称:phpbench,代码行数:21,代码来源:PhpBench.php

示例8: register

 /**
  * Registers this instance as an autoloader.
  *
  * @param bool $prepend Whether to prepend the autoloader or not
  */
 public function register($prepend = false)
 {
     $this->composerClassLoader->unregister();
     spl_autoload_register(array($this, 'loadClassWithAlias'), true, $prepend);
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:10,代码来源:ClassAliasLoader.php

示例9: initializeSettings

 /**
  * Locate site path and initialize settings singleton.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  *   The current request.
  *
  * @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
  *   In case the host name in the request is not trusted.
  */
 protected function initializeSettings(Request $request)
 {
     $site_path = static::findSitePath($request);
     $this->setSitePath($site_path);
     $class_loader_class = get_class($this->classLoader);
     Settings::initialize($this->root, $site_path, $this->classLoader);
     // Initialize our list of trusted HTTP Host headers to protect against
     // header attacks.
     $host_patterns = Settings::get('trusted_host_patterns', array());
     if (PHP_SAPI !== 'cli' && !empty($host_patterns)) {
         if (static::setupTrustedHosts($request, $host_patterns) === FALSE) {
             throw new BadRequestHttpException('The provided host name is not valid for this server.');
         }
     }
     // If the class loader is still the same, possibly upgrade to the APC class
     // loader.
     if ($class_loader_class == get_class($this->classLoader) && Settings::get('class_loader_auto_detect', TRUE) && function_exists('apcu_fetch')) {
         $prefix = Settings::getApcuPrefix('class_loader', $this->root);
         $apc_loader = new ApcClassLoader($prefix, $this->classLoader);
         $this->classLoader->unregister();
         $apc_loader->register();
         $this->classLoader = $apc_loader;
     }
 }
开发者ID:sgtsaughter,项目名称:d8portfolio,代码行数:33,代码来源:DrupalKernel.php

示例10: __construct

 /**
  * @param ComposerClassLoader $composerClassLoader
  */
 public function __construct(ComposerClassLoader $composerClassLoader)
 {
     $composerClassLoader->unregister();
     $this->composerClassLoader = $composerClassLoader;
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:8,代码来源:ClassAliasLoader.php

示例11: reloadClassLoader

 /**
  * Reloac class loader
  */
 protected function reloadClassLoader()
 {
     $this->classLoader->unregister();
     $this->classLoader = $this->generateClassLoader($this->getComposer());
     $this->classLoader->register();
 }
开发者ID:opis,项目名称:colibri,代码行数:9,代码来源:Application.php

示例12: unRegisterLoader

 private function unRegisterLoader()
 {
     $this->loader->unregister();
 }
开发者ID:helhum,项目名称:typo3-console-plugin,代码行数:4,代码来源:ScriptDispatcher.php


注:本文中的Composer\Autoload\ClassLoader::unregister方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。