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


PHP Autoloader类代码示例

本文整理汇总了PHP中Autoloader的典型用法代码示例。如果您正苦于以下问题:PHP Autoloader类的具体用法?PHP Autoloader怎么用?PHP Autoloader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: register

 public function register()
 {
     // Params
     set_time_limit(0);
     clearstatcache();
     // Error log
     $this->initErrorHandling();
     // External classes
     require_once $this->getCorePath() . '/classes/class.util.php';
     Util::logSeparator();
     // Autoloader
     require_once $this->getCorePath() . '/classes/class.autoloader.php';
     $neardAutoloader = new Autoloader();
     $neardAutoloader->register();
     // Load
     self::loadCore();
     self::loadConfig();
     self::loadLang();
     self::loadBins();
     self::loadTools();
     self::loadApps();
     self::loadWinbinder();
     self::loadRegistry();
     self::loadHomepage();
     // Init
     if ($this->isBootstrap) {
         $this->procs = Win32Ps::getListProcs();
     }
 }
开发者ID:RobertoMalatesta,项目名称:neard,代码行数:29,代码来源:class.bootstrap.php

示例2: testAutoloaderUsesTokenizer

 /**
  * Asserts that the tokenizer is used as default
  *
  * @return void
  */
 public function testAutoloaderUsesTokenizer()
 {
     $this->assertTrue(AutoloaderFileParser_Tokenizer::isSupported());
     $autoloader = new Autoloader();
     $autoloader->register();
     $autoloader->remove();
     $this->assertTrue($autoloader->getParser() instanceof AutoloaderFileParser_Tokenizer);
 }
开发者ID:xxdf,项目名称:showtimes,代码行数:13,代码来源:TestParser.php

示例3: testAutoloaderIncludesMatchingSourceFile

 /**
  * @return void
  * @covers \pdepend\reflection\Autoloader
  * @group reflection
  * @group unittest
  */
 public function testAutoloaderIncludesMatchingSourceFile()
 {
     $classFixture = '\\pdepend\\reflection\\autoloader\\Test';
     if (class_exists($classFixture, false)) {
         $this->fail('Class ' . $classFixture . ' should not exist');
     }
     $autoloader = new Autoloader(__DIR__ . '/_source/');
     $autoloader->autoload($classFixture);
     $this->assertTrue(class_exists($classFixture, false), 'Class should exist ' . $classFixture);
 }
开发者ID:naderman,项目名称:pflow,代码行数:16,代码来源:AutoloaderTest.php

示例4: __construct

 /**
  * __construct
  *
  * Constructs the object.
  *
  * @access public
  * @param  \Pimple $pimple
  * @return void
  */
 public function __construct(\Pimple $pimple)
 {
     $this->pimple = $pimple;
     $this->config = $pimple['config'];
     $this->setReporting();
     $appDir = $this->config['general.appDir'] . 'src';
     $appLoader = new Autoloader($this->config['general.namespace'], $appDir);
     $appLoader->register();
     $this->router = new Router($this->pimple);
     $this->session = $this->pimple['session'];
     $this->session->start();
     $this->session->set('language', $this->session->get('language', $this->config['general.default_language']));
 }
开发者ID:nilsabegg,项目名称:rueckgrat,代码行数:22,代码来源:Bootloader.php

示例5: registerAutoloaders

 /**
  * This method will load and register a new autoloader for the system
  * multiple autoloader instances may be used.
  */
 public static function registerAutoloaders()
 {
     require_once 'Autoloader.php';
     $autoloader = new Autoloader(__NAMESPACE__, BASE);
     $autoloader->register();
     /**
      * Override Basic error handling with Whoops
      */
     $whoopsload = new Autoloader('Whoops', BASE . 'vendor' . DS . 'filp' . DS . 'whoops' . DS . 'src' . DS . '');
     $whoopsload->register();
     $wh = new \Whoops\Run();
     $wh->pushHandler(new \Whoops\Handler\PrettyPageHandler());
     $wh->register();
 }
开发者ID:xdbas,项目名称:restwork,代码行数:18,代码来源:Application.php

示例6: LoadComponents

 public static function LoadComponents()
 {
     $Components = array('Classes');
     foreach ($Components as $Component) {
         Autoloader::LoadOrder($Component);
     }
 }
开发者ID:anonymous33rus,项目名称:FreedomCore,代码行数:7,代码来源:Autoloader.Class.php

示例7: addClassDir

 /**
  * Add a path to the class directories
  *
  * @param string        $sDir                The path to the directory
  * @param string|null    $sNamespace            The associated namespace
  * @param array         $aExcluded            The functions that are not to be exported
  *
  * @return boolean
  */
 public function addClassDir($sDir, $sNamespace = null, array $aExcluded = array())
 {
     if (!is_dir($sDir = trim($sDir))) {
         return false;
     }
     if (!($sNamespace = trim($sNamespace))) {
         $sNamespace = null;
     }
     if ($sNamespace) {
         $sNamespace = trim($sNamespace, '\\');
         // If there is an autoloader, register the dir with PSR4 autoloading
         if ($this->xAutoloader) {
             $this->xAutoloader->setPsr4($sNamespace . '\\', $sDir);
         }
     } else {
         if ($this->xAutoloader) {
             // If there is an autoloader, register the dir with classmap autoloading
             $itDir = new RecursiveDirectoryIterator($sDir);
             $itFile = new RecursiveIteratorIterator($itDir);
             // Iterate on dir content
             foreach ($itFile as $xFile) {
                 // skip everything except PHP files
                 if (!$xFile->isFile() || $xFile->getExtension() != 'php') {
                     continue;
                 }
                 $this->xAutoloader->addClassMap(array($xFile->getBasename('.php') => $xFile->getPathname()));
             }
         }
     }
     $this->aClassDirs[] = array('path' => $sDir, 'namespace' => $sNamespace, 'excluded' => $aExcluded);
     return true;
 }
开发者ID:lagdo,项目名称:xajax-core,代码行数:41,代码来源:Manager.php

示例8: save

 /**
  * Formats the output and saved it to disc.
  *
  * @param   string     $identifier  filename
  * @param   $contents  $contents    language array to save
  * @return  bool       \File::update result
  */
 public function save($identifier, $contents)
 {
     // store the current filename
     $file = $this->file;
     // save it
     $return = parent::save($identifier, $contents);
     // existing file? saved? and do we need to flush the opcode cache?
     if ($file == $this->file and $return and static::$flush_needed) {
         if ($this->file[0] !== '/' and (!isset($this->file[1]) or $this->file[1] !== ':')) {
             // locate the file
             if ($pos = strripos($identifier, '::')) {
                 // get the namespace path
                 if ($file = \Autoloader::namespace_path('\\' . ucfirst(substr($identifier, 0, $pos)))) {
                     // strip the namespace from the filename
                     $identifier = substr($identifier, $pos + 2);
                     // strip the classes directory as we need the module root
                     $file = substr($file, 0, -8) . 'lang' . DS . $identifier;
                 } else {
                     // invalid namespace requested
                     return false;
                 }
             } else {
                 $file = \Finder::search('lang', $identifier);
             }
         }
         // make sure we have a fallback
         $file or $file = APPPATH . 'lang' . DS . $identifier;
         // flush the opcode caches that are active
         static::$uses_opcache and opcache_invalidate($file, true);
         static::$uses_apc and apc_compile_file($file);
     }
     return $return;
 }
开发者ID:takawasitobi,项目名称:pembit,代码行数:40,代码来源:php.php

示例9: testCacheFileCanBeManuallySaved

 public function testCacheFileCanBeManuallySaved()
 {
     Autoloader::saveCachedPaths();
     $this->assertTrue(file_exists($this->cacheFile), 'Cache file should exist');
     $this->assertTrue(filesize($this->cacheFile) > 0, 'Cache file should be non-empty');
     $this->removeCacheFile();
 }
开发者ID:jmhobbs,项目名称:MkLst,代码行数:7,代码来源:TestAutoloader.class.php

示例10: attach

 public function attach()
 {
     if (!isset($this->name)) {
         $this->name = Autoloader::uniqueName();
     }
     Autoloader::attach($this);
 }
开发者ID:jjanes,项目名称:Amber-PHP-Application-Framework,代码行数:7,代码来源:system.autoloader.php

示例11: initialize

 public static function initialize()
 {
     if (defined('TESTS_ENV') || self::is_dev()) {
         ini_set('display_errors', 'on');
         error_reporting(E_ALL);
     } else {
         ini_set('display_errors', 'off');
         error_reporting(0);
     }
     require_once ROOT_PATH . DS . 'common' . DS . 'classes' . DS . 'autoloader.php';
     Autoloader::init_autoload();
     FileSystemHelper::init_dirs();
     LIVR::defaultAutoTrim(true);
     /**
      * @var $system \System
      */
     $system = static::get_class(\System::class);
     $system->initialize();
     /**
      * @var $configuration Configuration
      */
     $configuration = Application::get_class(Configuration::class);
     $current_lang = $configuration->language;
     defined('CURRENT_LANG') or define('CURRENT_LANG', $current_lang);
 }
开发者ID:one-more,项目名称:peach_framework,代码行数:25,代码来源:application.php

示例12: testUnregisterRegistersAutoloaderProperly

 /**
  * Test unregister method unregisters autoloader class and method properly.
  */
 public function testUnregisterRegistersAutoloaderProperly()
 {
     $this->setUpAutoloaderWithStrategy();
     $this->registerAutoloaderStrategyMock();
     $this->autoloader->unregister();
     $this->assertAutoloaderUnregistered();
 }
开发者ID:exorg,项目名称:autoloader,代码行数:10,代码来源:AutoloaderTest.php

示例13: testAutoloadValidGeodeticClass

 public function testAutoloadValidGeodeticClass()
 {
     $className = 'Geodetic\\Angle';
     $result = Autoloader::Load($className);
     //    Check that class has been loaded
     $this->assertTrue(class_exists($className));
 }
开发者ID:markbaker,项目名称:phpgeodetic,代码行数:7,代码来源:AutoloaderTest.php

示例14: getPath

 public static function getPath()
 {
     if (!self::$path) {
         self::$path = realpath(dirname(__FILE__));
     }
     return self::$path;
 }
开发者ID:tin-cat,项目名称:redis-info,代码行数:7,代码来源:Autoloader.php

示例15: GetInstance

 public static function GetInstance()
 {
     if (!self::$_Instance) {
         self::$_Instance = new self();
     }
     return self::$_Instance;
 }
开发者ID:nvadim,项目名称:ArrayTree,代码行数:7,代码来源:Autoloader.class.php


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