filter() 공개 정적인 메소드

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.
리턴 string[] The paths matching the glob indexed by their original keys.
예제 #1
0
파일: GlobTest.php 프로젝트: sebwebdev/glob
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage *.css
  */
 public function testFilterFailsIfNotAbsolute()
 {
     Glob::filter(array('/foo/bar.css'), '*.css');
 }
예제 #2
0
파일: GlobTest.php 프로젝트: webmozart/glob
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testFilterFailsIfInvalidFlags()
 {
     Glob::filter(array(42 => '/foo/bar.css'), '/foo/*.css', Glob::FILTER_KEY | Glob::FILTER_VALUE);
 }