0
0

Bootstrap.php 966 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. include_once __DIR__ . '/Autoloader.php';
  3. \Complex\Autoloader::Register();
  4. abstract class FilesystemRegexFilter extends RecursiveRegexIterator
  5. {
  6. protected $regex;
  7. public function __construct(RecursiveIterator $it, $regex)
  8. {
  9. $this->regex = $regex;
  10. parent::__construct($it, $regex);
  11. }
  12. }
  13. class FilenameFilter extends FilesystemRegexFilter
  14. {
  15. // Filter files against the regex
  16. public function accept()
  17. {
  18. return (!$this->isFile() || preg_match($this->regex, $this->getFilename()));
  19. }
  20. }
  21. $srcFolder = __DIR__ . DIRECTORY_SEPARATOR . 'src';
  22. $srcDirectory = new RecursiveDirectoryIterator($srcFolder);
  23. $filteredFileList = new FilenameFilter($srcDirectory, '/(?:php)$/i');
  24. $filteredFileList = new FilenameFilter($filteredFileList, '/^(?!.*(Complex|Exception)\.php).*$/i');
  25. foreach (new RecursiveIteratorIterator($filteredFileList) as $file) {
  26. if ($file->isFile()) {
  27. include_once $file;
  28. }
  29. }