• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Autoloader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Autoloader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: loadAutoloader

 static function loadAutoloader($class)
 {
     spl_autoload_unregister(array(__CLASS__, __FUNCTION__));
     require PATCHWORK_PROJECT_PATH . '.patchwork.autoloader.php';
     spl_autoload_register(array('Patchwork\\Autoloader', 'loadClass'));
     Autoloader::loadClass($class);
 }
开发者ID:nicolas-grekas,项目名称:Patchwork,代码行数:7,代码来源:Superloader.php


示例15: getInstance

 /**
  * Well, if you want, you can use it as a singleton....
  * @return Autoloader $singleton instance
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new Autoloader();
     }
     return self::$instance;
 }
开发者ID:jaysonantig,项目名称:cohesion-core,代码行数:11,代码来源:Autoloader.php


示例16: testLoad

 public function testLoad()
 {
     $autoloader = new Autoloader();
     $autoloader->addPath('Foo', 'src/Models');
     $autoloader->addPath('Foo', 'src/Helpers');
     $autoloader->addPath('Foo\\Selection', 'src/Models/Selection');
     $this->assertFalse($autoloader->load('Bar'));
     $this->assertFalse($autoloader->load('Foo\\Bar'));
     $this->assertTrue($autoloader->load('Foo\\Helper'));
     $this->assertTrue($autoloader->load('Foo\\Model'));
     $this->assertTrue($autoloader->load('Foo\\Selection\\SelectionBuilder'));
     // TODO: mock loadFrom and test paths etc.
 }
开发者ID:jivoo,项目名称:jivoo,代码行数:13,代码来源:AutoloaderTest.php


示例17: run

 public function run()
 {
     $loader = Autoloader::instance();
     pc($loader, 'loader');
     $ViewClass = $loader->view();
     $view = new $ViewClass();
     $view->render();
 }
开发者ID:solutionworks,项目名称:theme-setup,代码行数:8,代码来源:App.php


示例18: load_class

 public static function load_class($class_name)
 {
     $filename = Autoloader::load_class_path($class_name);
     if (file_exists($filename)) {
         require $filename;
         return true;
     }
 }
开发者ID:curseoff,项目名称:pgit,代码行数:8,代码来源:autoloader.php


示例19: singleton

 /**
  * create an autoloader instance
  *
  * @return Autoloader
  */
 public static function singleton()
 {
     if (self::$_instance instanceof self === true) {
         return self::$_instance;
     }
     self::$_instance = new self();
     return self::$_instance;
 }
开发者ID:kafruhs,项目名称:fws,代码行数:13,代码来源:Autoloader.php


示例20: testAutoload

 /**
  * Asserts that the class $class is loadable after
  * registration of its class definition $path
  *
  * @param String $class The class which is autoloaded
  * @param String $path  The class defintion
  * 
  * @dataProvider provideTestAutoload
  * @return void
  * @see InternalAutoloader::registerClass()
  */
 public function testAutoload($class, $path)
 {
     $autoloaderTestHelper = new AutoloaderTestHelper($this);
     Autoloader::removeAll();
     $autoloaderTestHelper->assertNotLoadable($class);
     InternalAutoloader::getInstance()->registerClass($class, $path);
     $autoloaderTestHelper->assertLoadable($class);
 }
开发者ID:rolwi,项目名称:koala,代码行数:19,代码来源:TestInternalAutoloader.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP AuxLib类代码示例发布时间:2022-05-23
下一篇:
PHP Autoload类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap