protected function getNamePattern(array $criteria, string $extension): string
    {
        $names = [];

        $names[] = array_map(function ($criterion) use ($extension) {
            $uriExtension = URIHelper::containsExtension($criterion);
            if (! empty($extension)) {
                $extension = ltrim($extension, '.');

                if ($uriExtension === $extension) {
                    $criterion = substr($criterion,0,-strlen(".{$extension}"));
                }
            } else {
                $extension = URIHelper::containsExtension($criterion);
                if (!empty($extension)) {
                    $criterion = substr($criterion,0,-strlen(".{$extension}"));
                }
            }

            $criterion = preg_quote(URIHelper::getFilename($criterion), chr(1));

            return (empty($extension) || URIHelper::hasExtension($criterion, $extension))
                ? "{$criterion}(?:\..*?)$"
                : "{$criterion}\.{$extension}$";
        }, $criteria)[0];

        return chr(1) . implode('|', array_unique($names)) . chr(1);
    }
protected function getNamePattern(array $criteria, string $extension): string
    {
        $names = [];

        $names[] = array_map(function ($criterion) use ($extension) {
            $uriExtension = URIHelper::containsExtension($criterion);
            if (! empty($extension)) {
                $extension = ltrim($extension, '.');

                if ($uriExtension === $extension) {
                    $criterion = substr($criterion,0,-strlen(".{$extension}"));
                }
            } else {
                $extension = URIHelper::containsExtension($criterion);
                if (!empty($extension)) {
                    $criterion = substr($criterion,0,-strlen(".{$extension}"));
                }
            }

            $criterion = preg_quote(URIHelper::getFilename($criterion), chr(1));

            return (empty($extension) || URIHelper::hasExtension($criterion, $extension))
                ? "{$criterion}(?:\..*?)$"
                : "{$criterion}\.{$extension}$";
        }, $criteria)[0];

        return chr(1) . implode('|', array_unique($names)) . chr(1);
    }
protected function getNamePattern ( array $ criteria , string $ extension ) : string { $ names = [ ] ; $ names [ ] = array_map ( function ( $ criterion ) use ( $ extension ) { $ uriExtension = URIHelper :: containsExtension ( $ criterion ) ; if ( ! empty ( $ extension ) ) { $ extension = ltrim ( $ extension , '.' ) ; if ( $ uriExtension === $ extension ) { $ criterion = substr ( $ criterion , 0 , - strlen ( ".{$extension}" ) ) ; } } else { $ extension = URIHelper :: containsExtension ( $ criterion ) ; if ( ! empty ( $ extension ) ) { $ criterion = substr ( $ criterion , 0 , - strlen ( ".{$extension}" ) ) ; } } $ criterion = preg_quote ( URIHelper :: getFilename ( $ criterion ) , chr ( 1 ) ) ; return ( empty ( $ extension ) || URIHelper :: hasExtension ( $ criterion , $ extension ) ) ? "{$criterion}(?:\..*?)$" : "{$criterion}\.{$extension}$" ; } , $ criteria ) [ 0 ] ; return chr ( 1 ) . implode ( '|' , array_unique ( $ names ) ) . chr ( 1 ) ; }
Get the name pattern to pass to the file finder.

@since 0.1.3

@param array  $criteria  Criteria to match.
@param string $extension Extension to match.

@return string Name pattern to pass to the file finder.
Get the name pattern to pass to the file finder .