當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ClassLoader::setUseIncludePath方法代碼示例

本文整理匯總了PHP中Composer\Autoload\ClassLoader::setUseIncludePath方法的典型用法代碼示例。如果您正苦於以下問題:PHP ClassLoader::setUseIncludePath方法的具體用法?PHP ClassLoader::setUseIncludePath怎麽用?PHP ClassLoader::setUseIncludePath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Composer\Autoload\ClassLoader的用法示例。


在下文中一共展示了ClassLoader::setUseIncludePath方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: registerDefaultAutoloading

 /**
  * Registers default autoloading for the Extension.
  *
  * @return \Composer\Autoload\ClassLoader
  */
 public function registerDefaultAutoloading()
 {
     $loader = new ClassLoader();
     $loader->add($this->namespace, $this->path . '/src');
     $loader->register();
     $loader->setUseIncludePath(true);
     return $this->autoloaders[] = $loader;
 }
開發者ID:sohailaammarocs,項目名稱:lfc,代碼行數:13,代碼來源:Extension.php

示例2: loadModule

 protected function loadModule($modCfgArray, $modIdx)
 {
     $cfg = new Config($modCfgArray['default']);
     $ns = $cfg->get('namespace');
     // If this class can't be loaded, enable the autoload using the composer class loader.
     if (!empty($ns)) {
         // Full directory of the module to be initialized.
         $dir = $cfg->get('directory');
         $parentDir = $this->config->get('directory');
         $parentModulesDir = $this->config->get('modulesDir');
         if (preg_match('/^\\//', $dir) > 0) {
         } else {
             if (preg_match('/^\\//', $parentModulesDir) > 0) {
                 $dir = $parentModulesDir . DIRECTORY_SEPARATOR . $dir;
             } else {
                 $dir = $parentDir . DIRECTORY_SEPARATOR . $parentModulesDir . DIRECTORY_SEPARATOR . $dir;
             }
         }
         $dirReal = realpath($dir) . DIRECTORY_SEPARATOR;
         if (!$dirReal) {
             throw new \Exception("The directory {$dir} of the child module does not exists or is not readable.");
         }
         // Override the current module 'directory' value
         $cfg->set('directory', $dir);
         // Add the namespacec to the  composer ClassLoader
         $loader = new ClassLoader();
         $loader->add($ns, $dir);
         $loader->register();
         $loader->setUseIncludePath(true);
     }
     if ($cn = $cfg->get('moduleClassName')) {
         $mClass = $ns . '\\' . $cn;
     } else {
         // Use the default moduleClassName. See the top of this file.
         $mClass = $this->config->get('moduleClassName');
     }
     // Add others options sets, if provided
     foreach ($modCfgArray as $k => $optSet) {
         if ($k == 'default') {
             continue;
         }
         $cfg->set($optSet, null, $k);
     }
     // Instance the module.
     $mod = new $mClass($cfg, $this, $this->injections);
     return $this->children[$modIdx] = $mod;
 }
開發者ID:iplox,項目名稱:iplox,代碼行數:47,代碼來源:BaseModule.php

示例3: registerAutoloading

 /**
  * Register the class autoloading.
  * 
  * @return void
  */
 protected function registerAutoloading()
 {
     // Instantiate the class loader.
     $loader = new ClassLoader();
     // Add the extension namespace and path.
     $loader->add($this->namespace, $this->path . '/src');
     // Register the loader.
     $loader->register();
     // Use the path for includes.
     $loader->setUseIncludePath(true);
 }
開發者ID:maclof,項目名稱:extensions,代碼行數:16,代碼來源:Extension.php


注:本文中的Composer\Autoload\ClassLoader::setUseIncludePath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。