bootstrap.php 1.6 KB

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