Sets the namespace separator used by classes in the namespace of this class loader.
public setNamespaceSeparator ( string $sep ) | ||
$sep | string | The separator to use. |
$bt = debug_backtrace(); $lines = file($bt[1]['file']); preg_match('/([a-zA-Z0-9\\_]+)::' . $bt[1]['function'] . '/', $lines[$bt[1]['line'] - 1], $matches); return $matches[1]; } } try { require_once APP_PATH . '/public/SplClassLoader.php'; $classLoader = new SplClassLoader('Hmv', APP_PATH . '/../vendor/Hmv4'); $classLoader->setNamespaceSeparator('_'); $classLoader->register(); $classLoader = new SplClassLoader('Tasks', APP_PATH . '/src'); $classLoader->setNamespaceSeparator('_'); $classLoader->register(); $classLoader = new SplClassLoader(null, APP_PATH . '/../vendor'); $classLoader->setNamespaceSeparator('_'); $classLoader->register(); $configPath = dirname(__FILE__) . '/../config/config.' . BATCH_EXEC_ENVIRONMENT . '.php'; $config = @(include $configPath); if ($config === false) { throw new Exception('config load error: "' . $configPath . '" file is not found.'); } // PSR-0に則りきれないのでここで強制的にrequire_onceしてしまう require_once APP_PATH . '/../vendor/Qdmail/qdmail.php'; require_once APP_PATH . '/../vendor/Qdmail/qdsmtp.php'; require_once APP_PATH . '/../vendor/Amazon/S3.php'; include APP_PATH . '/config/services.php'; $runner = new Teamlab_Batch_Task_Runner($di); $runner->run(); } catch (Exception $e) { /** @var Hmv_Mail $mailer */
* */ /******************************* * General Set-up *******************************/ // check to see if json_decode exists. might be disabled in installs of PHP 5.5 if (!function_exists("json_decode")) { print "Please check that your version of PHP includes the JSON extension. It's required for Pattern Lab to run. Aborting.\n"; exit; } // auto-load classes require __DIR__ . "/lib/SplClassLoader.php"; $loader = new SplClassLoader('PatternLab', __DIR__ . '/lib'); $loader->register(); $loader = new SplClassLoader('Mustache', __DIR__ . '/lib'); $loader->setNamespaceSeparator("_"); $loader->register(); /******************************* * Console Set-up *******************************/ $console = new PatternLab\Console(); // set-up the generate command and options $console->setCommand("g", "generate", "Generate Pattern Lab", "The generate command generates an entire site a single time. By default it removes old content in public/, compiles the patterns and moves content from source/ into public/"); $console->setCommandOption("g", "p", "patternsonly", "Generate only the patterns. Does NOT clean public/.", "To generate only the patterns:"); $console->setCommandOption("g", "n", "nocache", "Set the cacheBuster value to 0.", "To turn off the cacheBuster:"); $console->setCommandOption("g", "c", "enablecss", "Generate CSS for each pattern. Resource intensive.", "To run and generate the CSS for each pattern:"); // set-up an alias for the generate command $console->setCommand("b", "build", "Alias for the generate command", "Alias for the generate command. Please refer to it's help for full options."); // set-up the watch command and options $console->setCommand("w", "watch", "Watch for changes and regenerate", "The watch command builds Pattern Lab, watches for changes in source/ and regenerates Pattern Lab when there are any."); $console->setCommandOption("w", "p", "patternsonly", "Watches only the patterns. Does NOT clean public/.", "To watch and generate only the patterns:");
<?php if (version_compare(PHP_VERSION, '5.3', '>=')) { $loader = (require_once __DIR__ . '/vendor/autoload.php'); } else { require_once dirname(__FILE__) . '/vendor/splclassloader/SplClassLoader.php'; require_once dirname(__FILE__) . '/src/Snidel.php'; $loader = new SplClassLoader('Snidel', dirname(__FILE__) . '/src'); $loader->setNamespaceSeparator('_'); $loader->register(); }