[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 namespace RESTful; 4 5 /** 6 * Bootstrapper for RESTful does autoloading. 7 */ 8 class Bootstrap 9 { 10 const DIR_SEPARATOR = DIRECTORY_SEPARATOR; 11 const NAMESPACE_SEPARATOR = '\\'; 12 13 public static $initialized = false; 14 15 16 public static function init() 17 { 18 spl_autoload_register(array('\RESTful\Bootstrap', 'autoload')); 19 } 20 21 public static function autoload($classname) 22 { 23 self::_autoload(dirname(dirname(__FILE__)), $classname); 24 } 25 26 public static function pharInit() 27 { 28 spl_autoload_register(array('\RESTful\Bootstrap', 'pharAutoload')); 29 } 30 31 public static function pharAutoload($classname) 32 { 33 self::_autoload('phar://restful.phar', $classname); 34 } 35 36 private static function _autoload($base, $classname) 37 { 38 $parts = explode(self::NAMESPACE_SEPARATOR, $classname); 39 $path = $base . self::DIR_SEPARATOR . implode(self::DIR_SEPARATOR, $parts) . '.php'; 40 if (file_exists($path)) { 41 require_once($path); 42 } 43 } 44 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |