Glob.php 780 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Filesystem;
  7. use Zend\Stdlib\Glob as ZendGlob;
  8. use Zend\Stdlib\Exception\RuntimeException as ZendRuntimeException;
  9. /**
  10. * Wrapper for Zend\Stdlib\Glob
  11. */
  12. class Glob extends ZendGlob
  13. {
  14. /**
  15. * Find pathnames matching a pattern.
  16. *
  17. * @param string $pattern
  18. * @param int $flags
  19. * @param bool $forceFallback
  20. * @return array
  21. */
  22. public static function glob($pattern, $flags = 0, $forceFallback = false)
  23. {
  24. try {
  25. $result = ZendGlob::glob($pattern, $flags, $forceFallback);
  26. } catch (ZendRuntimeException $e) {
  27. $result = [];
  28. }
  29. return $result;
  30. }
  31. }