public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInit80787ad90ea5f9f8203914811ad653b2', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit80787ad90ea5f9f8203914811ad653b2', 'loadClassLoader')); $vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); $includePaths = (require __DIR__ . '/include_paths.php'); array_push($includePaths, get_include_path()); set_include_path(join(PATH_SEPARATOR, $includePaths)); $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = (require __DIR__ . '/autoload_psr4.php'); foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $loader->register(true); $includeFiles = (require __DIR__ . '/autoload_files.php'); foreach ($includeFiles as $file) { \Composer\Autoload\includeFile($file); } return $loader; }
/** * @param string $class * * @return bool */ public function loadClass($class) { if (strpos(ltrim($class, '\\'), __NAMESPACE__) === 0) { return $this->composer->loadClass($class); } elseif ($file = $this->composer->findFile($class)) { \Composer\Autoload\includeFile('php://filter/read=influence.reader/resource=' . $file); return true; } return false; }
/** * Загрузка и активация класса * @param string $class_name Class name with namespace * @return bool * @throws \ErrorException */ static function loadClass($class_name) { if ($file = self::$loader->findFile($class_name)) { self::$included[$class_name] = $class_name; \Composer\Autoload\includeFile($file); if (isset(class_implements($class_name, false)['boolive\\core\\IActivate'])) { self::$activated[$class_name] = $class_name; $class_name::activate(); } return true; } else { throw new ErrorException('Class "' . $class_name . '" not found', 2); } }
<?php namespace App\Model; \Composer\Autoload\includeFile(dirname(__DIR__) . '/../mpdf60/mpdf.php'); use Nette; use Nette\Object; use mPDF; /** * Trida pro vytvoreni exportu ve formatech CSV a PDF ze zadanych kriterii * @package App\Model */ class ExportManager extends Object { /** @var Nette\Database\Context */ private $database; public function __construct(Nette\Database\Context $database) { $this->database = $database; } /** * Funkce vytvori s objektu dvojrozmerne pole * @param object $source objekt obsahujici strukturu dat * @return array $source dvojrozmerne pole */ public function toArray($source) { if (is_object($source)) { list($source) = self::toArray(array($source)); } if (!is_array($source)) {
$listener = new BasicHtml(dirname($testDir) . "/test-results.html"); $mocker = new Mocker(new Prophet(), new SignatureReader()); DSLAccessor::init(new Tester($listener, $mocker)); set_error_handler(function ($level, $message, $file = 'unknown', $line = 0, $context = array()) { $regex = '/^Argument (\\d)+ passed to \\{closure\\}\\(\\) must (?:be an instance of|implement interface) ([\\w\\\\]+),(?: instance of)? ([\\w\\\\]+) given/'; if (E_RECOVERABLE_ERROR === $level && preg_match($regex, $message, $matches)) { list($_, $_, $shouldBe, $type) = $matches; if ($type === "Prophecy\\Prophecy\\ObjectProphecy") { return true; } } return false; }); output("Jasmini"); output("======="); output(""); foreach (new DirectoryIterator($testDir) as $test) { if (in_array($test, array(".", ".."))) { continue; } output("Testing: {$test}"); \Composer\Autoload\includeFile($test->getRealPath()); } $listener->stop(); output(""); output("Finished"); output(""); function output($msg) { echo $msg, PHP_EOL; }
*/ // List of supported timezones: http://php.net/manual/en/timezones.php date_default_timezone_set('UTC'); setlocale(LC_ALL, 'en_US.UTF-8'); /** * Autoloading */ require DOCUMENT_ROOT . '/vendor/composer' . '/ClassLoader.php'; $loader = new \Composer\Autoload\ClassLoader(); $classMap = (require DOCUMENT_ROOT . '/vendor/composer' . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $includeFiles = (require DOCUMENT_ROOT . '/vendor/composer' . '/autoload_files.php'); foreach ($includeFiles as $file) { Composer\Autoload\includeFile($file); } $loader->register(true); /** * Error handler */ error_reporting(E_ALL); ini_set('display_errors', 'On'); ini_set('log_errors', 'On'); ini_set('error_log', sprintf(DOCUMENT_ROOT . '/data/logs/php_errors-%s.txt', date('Y-m-d'))); if (php_sapi_name() !== 'cli') { if (IS_DEV) { $whoops = new \Whoops\Run(); $handler = new \Whoops\Handler\PrettyPageHandler(); $handler->setEditor('sublime'); $whoops->pushHandler($handler);
protected static function _loadFiles($files) { foreach ((array) $files as $file) { \Composer\Autoload\includeFile($file); } }