filter() public static method

The filtered array is returned. This array preserves the keys of the passed array. php $filteredPaths = Glob::filter($paths, '/project/**.twig');
public static filter ( array $paths, string $glob, integer $flags = self::FILTER_VALUE ) : string[]
$paths array A list of paths.
$glob string The canonical glob. The glob should contain forward slashes as directory separators only. It must not contain any "." or ".." segments. Use the "webmozart/path-util" utility to canonicalize globs prior to calling this method.
$flags integer A bitwise combination of the flag constants in this class.
return string[] The paths matching the glob indexed by their original keys.
Esempio n. 1
0
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage *.css
  */
 public function testFilterFailsIfNotAbsolute()
 {
     Glob::filter(array('/foo/bar.css'), '*.css');
 }
Esempio n. 2
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testFilterFailsIfInvalidFlags()
 {
     Glob::filter(array(42 => '/foo/bar.css'), '/foo/*.css', Glob::FILTER_KEY | Glob::FILTER_VALUE);
 }