bootstrap.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Bootstrap the library. This registers a simple autoloader for autoloading
  4. * classes
  5. *
  6. * If you are using this library inside of another that uses a similar
  7. * autoloading system, you can use that autoloader instead of this file.
  8. *
  9. * PHP version 5.3
  10. *
  11. * @category PHPPasswordLib
  12. * @package test
  13. * @author Anthony Ferrara <ircmaxell@ircmaxell.com>
  14. * @copyright 2011 The Authors
  15. * @license http://opensource.org/licenses/bsd-license.php New BSD License
  16. * @license http://www.gnu.org/licenses/lgpl-2.1.html LGPL v 2.1
  17. */
  18. namespace SecurityLibTest;
  19. ini_set('memory_limit', '1G');
  20. /**
  21. * The simple autoloader for the PasswordLibTest libraries.
  22. *
  23. * This does not use the PRS-0 standards due to the namespace prefix and directory
  24. * structure
  25. *
  26. * @param string $class The class name to load
  27. *
  28. * @return void
  29. */
  30. spl_autoload_register(function ($class) {
  31. $nslen = strlen(__NAMESPACE__);
  32. if (substr($class, 0, $nslen) != __NAMESPACE__) {
  33. //Only autoload libraries from this package
  34. return;
  35. }
  36. $path = substr(str_replace('\\', '/', $class), $nslen);
  37. $path = __DIR__ . $path . '.php';
  38. if (file_exists($path)) {
  39. require $path;
  40. }
  41. });
  42. define('PATH_ROOT', dirname(__DIR__));
  43. require_once dirname(__DIR__) . '/vendor/autoload.php';