public static function getBasePath($glob, $flags = 0)
    {
        // Search the static prefix for the last "/"
        $staticPrefix = self::getStaticPrefix($glob, $flags);

        if (false !== ($pos = strrpos($staticPrefix, '/'))) {
            // Special case: Return "/" if the only slash is at the beginning
            // of the glob
            if (0 === $pos) {
                return '/';
            }

            // Special case: Include trailing slash of "scheme:///foo"
            if ($pos - 3 === strpos($glob, '://')) {
                return substr($staticPrefix, 0, $pos + 1);
            }

            return substr($staticPrefix, 0, $pos);
        }

        // Glob contains no slashes on the left of the wildcard
        // Return an empty string
        return '';
    }
public static function getBasePath($glob, $flags = 0)
    {
        // Search the static prefix for the last "/"
        $staticPrefix = self::getStaticPrefix($glob, $flags);

        if (false !== ($pos = strrpos($staticPrefix, '/'))) {
            // Special case: Return "/" if the only slash is at the beginning
            // of the glob
            if (0 === $pos) {
                return '/';
            }

            // Special case: Include trailing slash of "scheme:///foo"
            if ($pos - 3 === strpos($glob, '://')) {
                return substr($staticPrefix, 0, $pos + 1);
            }

            return substr($staticPrefix, 0, $pos);
        }

        // Glob contains no slashes on the left of the wildcard
        // Return an empty string
        return '';
    }
public static function getBasePath ( $ glob , $ flags = 0 ) { // Search the static prefix for the last "/" $ staticPrefix = self :: getStaticPrefix ( $ glob , $ flags ) ; if ( false !== ( $ pos = strrpos ( $ staticPrefix , '/' ) ) ) { // Special case: Return "/" if the only slash is at the beginning // of the glob if ( 0 === $ pos ) { return '/' ; } // Special case: Include trailing slash of "scheme:///foo" if ( $ pos - 3 === strpos ( $ glob , '://' ) ) { return substr ( $ staticPrefix , 0 , $ pos + 1 ) ; } return substr ( $ staticPrefix , 0 , $ pos ) ; } // Glob contains no slashes on the left of the wildcard // Return an empty string return '' ; }
Returns the base path of a glob.

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');
// => /
```

@param string $glob  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.
@param int    $flags A bitwise combination of the flag constants in this
class.

@return string The base path of the glob.
Returns the base path of a glob .