This method returns the most specific directory that contains all files
matched by the glob. If this directory does not exist on the file system,
it's not necessary to execute the glob algorithm.
More specifically, the "base path" is the longest path trailed by a "/"
on the left of the first wildcard "*". If the glob does not contain
wildcards, the directory name of the glob is returned.
php
Glob::getBasePath('/css/*.css');
=> /css
Glob::getBasePath('/css/style.css');
=> /css
Glob::getBasePath('/css/st*.css');
=> /css
Glob::getBasePath('/*.css');
=> /
public static getBasePath ( 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 base path of the glob. |