php basename() wrapper -- http://php.net/manual/en/function.basename.php

@param $path
@param bool $suffix
@return string
321851
public function baseNameFilter($path, $suffix = false)
    {
        if ($suffix) {
            $output = basename($path, $suffix);
        } else {
            $output = basename($path);
        }
        return $output;
    }
900756
public function getBasename($suffix = null)
    {
        if (null === $suffix) {
            $suffix = static::SEPARATOR_EXTENSION.$this->getExtension();
        }

        return parent::getBasename((string)$suffix);
    }
1314020
public function getBasenames(Finder $finder, $suffix = ''): array
    {
        $names = [];

        foreach ($finder as $splFileInfo) {
            /** @var \SplFileInfo $splFileInfo */
            $names[] = $splFileInfo->getBasename($suffix);
        }

        sort($names);

        return $names;
    }
250816
public function getUrl($path)
    {
        $path = $this->applyPathPrefix($path);

        return implode('/', [$this->baseUrl, $path]);
    }
1368293
public function getId($suffix = null)
    {
        $id = parent::getId($suffix);
        $id .= '-' . $this->fieldName;
        return HtmlHelper::nameToId($id);
    }
838471
private function match(string $path, string $suffix): bool
	{
		return substr($path, -strlen($suffix)) === $suffix;
	}
780125
private function basename($path)
    {
        $separators = '/';
        if (DIRECTORY_SEPARATOR != '/') {
            // For Windows OS add special separator.
            $separators .= DIRECTORY_SEPARATOR;
        }

        // Remove right-most slashes when $path points to directory.
        $path = rtrim($path, $separators);

        // Returns the trailing part of the $path starting after one of the directory separators.
        $filename = preg_match('@[^'.preg_quote($separators, '@').']+$@', $path, $matches) ? $matches[0] : '';

        return $filename;
    }
747477
protected function baseUrlPath($suffix = null, array $query = [])
    {
        /** @var string $baseUrlPath */
        $baseUrlPath = $this->baseUrlPath;

        if (!empty($suffix)) {
            $suffix = ltrim($suffix, "\/");
            $baseUrlPath .= '/' . trim($suffix);
        }

        if (!empty($query)) {
            $queryString  = http_build_query($query);
            $baseUrlPath .= '?' . $queryString;
        }

        return $baseUrlPath;
    }
100354
protected static function getFilename(string $path): string
    {
        $parts = pathinfo(urldecode($path));
        $path = isset($parts['dirname']) ? $parts['dirname'] : '';
        $filename = isset($parts['basename']) ? $parts['basename'] : '';

        //if has not extension, assume it's a directory and append index.html
        if (empty($parts['extension'])) {
            $filename .= '/index.html';
        }

        return str_replace('//', '/', $path.'/'.$filename);
    }
1117525
private function getPath($path)
    {
        if ($this->basePath === '' || strpos($path, $this->basePath) === 0) {
            $path = substr($path, strlen($this->basePath)) ?: '';
        }

        return $path === '' ? '/' : $path;
    }
1331713
public function getBaseFileName()
    {
        $pos = strrpos($this->fileName, '.');
        if ($pos === false) {
            return $this->fileName;
        }

        return substr($this->fileName, 0, $pos);
    }
998228
public function getPathByConvention($suffix = null)
    {
        $entityName = strtolower($this->getEntityName());
        $entityName = str_replace('\\', '_', $entityName);
        if (empty($suffix)) {
            return sprintf('%s_admin_%s', strtolower($this->getBundleName()), $entityName);
        }

        return sprintf('%s_admin_%s_%s', strtolower($this->getBundleName()), $entityName, $suffix);
    }
970029
public function baseUrl($path = null)
    {
        $backendUri = $this->uri();
        $baseUrl = Request::getBaseUrl();

        if ($path === null) {
            return $baseUrl . '/' . $backendUri;
        }

        $path = RouterHelper::normalizeUrl($path);
        return $baseUrl . '/' . $backendUri . $path;
    }
968290
public static function basename($path) {
        $pos = strrpos($path, '/');
        if ($pos === false) {
            return $path;
        }
        return substr($path, $pos + 1);
    }
1023979
protected function getCurrentPathRelativeToBase($path = null)
    {
        if (!$path) {
            // using $_SERVER instead of using Request method
            // to get original request path instead of any forwarded request
            $path = $_SERVER['REQUEST_URI'];
        }
        $base_path = $this->app['request']->getBasePath();
        return substr(strtok($path, '?'), strlen($base_path));
    }
700880
private function buildBasename(string $extension, string $ext, string $param = null): string
    {
        $length = strrpos($ext, '.'.pathinfo($ext, PATHINFO_EXTENSION));
        if (false !== $length) {
            $ext = substr($ext, 0, $length);
        }

        if (null !== $param && '' !== $param) {
            $param = ';'.$param;
        }

        $extension = trim($extension);
        if ('' === $extension) {
            return $ext.$param;
        }

        return $ext.'.'.$extension.$param;
    }
54838
protected function buildUrl($path)
    {
        $baseUrl = $this->getOption('base_url');

        //add trailing slash to the url if not supplied in the base_url setting nor supplied in path #6
        $url = $baseUrl . ((substr($baseUrl, -1) == '/' || substr($path, 0, 1) == '/') ? '' : '/') . $path;

        if (strpos($url, '.json') === false) {
            $url .= '.json';
        }

        return $url;
    }