glob() public static method

The glob may contain the wildcard "*". This wildcard matches any number of characters, *including* directory separators. php foreach (Glob::glob('/project/**.twig') as $path) { do something... }
public static glob ( string $glob, integer $flags ) : string[]
$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 matching paths. The keys of the array are incrementing integers.
コード例 #1
0
 private function actionForGlob($action, $rootDirectory, $globPattern)
 {
     $matches = Glob::glob($globPattern);
     return array_reduce($matches, function ($acc, $file) use($action, $rootDirectory) {
         $acc[$file] = $this->strategy($action, $this->toAssetPath($file, $rootDirectory));
         return $acc;
     }, []);
 }
コード例 #2
0
ファイル: Lint.php プロジェクト: schorsch3000/phlop
 public function def($glob = 'src/**.php')
 {
     $buildOk = true;
     echo "Linting {$glob}\n";
     $files = Glob::glob(Path::makeAbsolute($glob, getcwd()));
     foreach ($files as $file) {
         $output = '';
         $returnValue = $this->runCommandSilent('php', ['-l', $file], $output);
         if ($returnValue) {
             echo "Linting error: {$output}\n";
             $buildOk = false;
         }
     }
     return $buildOk;
 }
コード例 #3
0
ファイル: GlobTest.php プロジェクト: sebwebdev/glob
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage *.css
  */
 public function testGlobFailsIfNotAbsolute()
 {
     Glob::glob('*.css');
 }