Documentation

Glob extends CompositeSpecification
in package

Glob specification class

Tags
psalm-immutable

Table of Contents

$boundedPrefix  : string
The "bounded prefix" is the part of the glob up to the first recursive wildcard "**".
$regex  : string
$staticPrefix  : string
The "static prefix" is the part of the glob up to the first wildcard "*".
$totalPrefix  : string|null
The "total prefix" is the part of the glob before the trailing catch-all wildcard sequence if the glob ends with one, otherwise null. It is needed for implementing the A-quantifier pruning hint.
__construct()  : mixed
andSpecification()  : AndSpecification
Returns a specification that satisfies the original specification as well as the other specification
canBeSatisfiedBySomethingBelow()  : bool
Checks if anything under the directory path in value can possibly satisfy the specification.
isSatisfiedBy()  : bool
notSpecification()  : NotSpecification
Returns a specification that is the inverse of the original specification i.e. does not meet the original criteria
orSpecification()  : OrSpecification
Returns a specification that satisfies the original specification or the other specification
thatCanBeSatisfiedBySomethingBelow()  : bool
Provide default {@see canBeSatisfiedBySomethingBelow()} logic for specification classes that don't implement PrunableInterface
thatWillBeSatisfiedByEverythingBelow()  : bool
Provide default {@see willBeSatisfiedByEverythingBelow()} logic for specification classes that don't implement PrunableInterface
willBeSatisfiedByEverythingBelow()  : bool
Returns true if it is known or can be deduced that everything under the directory path in value will certainly satisfy the specification.
assertValidGlob()  : void
Asserts that glob is well formed
getBoundedPrefix()  : string
getStaticPrefix()  : string
Returns the static prefix of a glob.
getTotalPrefix()  : string|null
isRecursiveWildcard()  : bool
Checks if the current position the glob is start of a Recursive directory wildcard
scanBackslashSequence()  : array<string|int, mixed>
toRegEx()  : string
Converts a glob to a regular expression.

Properties

$boundedPrefix

The "bounded prefix" is the part of the glob up to the first recursive wildcard "**".

private string $boundedPrefix

It is the longest prefix for which the number of directory segments in the partial match is known. If the glob does not contain the recursive wildcard "**", the full glob is returned.

$regex

private string $regex

$staticPrefix

The "static prefix" is the part of the glob up to the first wildcard "*".

private string $staticPrefix

If the glob does not contain wildcards, the full glob is returned.

$totalPrefix

The "total prefix" is the part of the glob before the trailing catch-all wildcard sequence if the glob ends with one, otherwise null. It is needed for implementing the A-quantifier pruning hint.

private string|null $totalPrefix

Methods

__construct()

public __construct(string $glob) : mixed
Parameters
$glob : string
Return values
mixed

canBeSatisfiedBySomethingBelow()

Checks if anything under the directory path in value can possibly satisfy the specification.

public canBeSatisfiedBySomethingBelow(array<string|int, mixed> $value) : bool
Parameters
$value : array<string|int, mixed>
Tags
inheritDoc
Return values
bool

isSatisfiedBy()

public isSatisfiedBy(array<string|int, mixed> $value) : bool
Parameters
$value : array<string|int, mixed>
Tags
inheritDoc
Return values
bool

thatCanBeSatisfiedBySomethingBelow()

Provide default {@see canBeSatisfiedBySomethingBelow()} logic for specification classes that don't implement PrunableInterface

public static thatCanBeSatisfiedBySomethingBelow(SpecificationInterface $that, array<string|int, mixed> $value) : bool
Parameters
$that : SpecificationInterface
$value : array<string|int, mixed>
Tags
psalm-param

array{basename: string, path: string, stream: resource, dirname: string, type: string, extension: string} $value

psalm-mutation-free
Return values
bool

thatWillBeSatisfiedByEverythingBelow()

Provide default {@see willBeSatisfiedByEverythingBelow()} logic for specification classes that don't implement PrunableInterface

public static thatWillBeSatisfiedByEverythingBelow(SpecificationInterface $that, array<string|int, mixed> $value) : bool
Parameters
$that : SpecificationInterface
$value : array<string|int, mixed>
Tags
psalm-param

array{basename: string, path: string, stream: resource, dirname: string, type: string, extension: string} $value

psalm-mutation-free
Return values
bool

willBeSatisfiedByEverythingBelow()

Returns true if it is known or can be deduced that everything under the directory path in value will certainly satisfy the specification.

public willBeSatisfiedByEverythingBelow(array<string|int, mixed> $value) : bool
Parameters
$value : array<string|int, mixed>
Tags
inheritDoc
Return values
bool

assertValidGlob()

Asserts that glob is well formed

private static assertValidGlob(string $glob) : void
Parameters
$glob : string
Tags
psalm-pure
Return values
void

getBoundedPrefix()

private static getBoundedPrefix(string $glob) : string
Parameters
$glob : string
Return values
string

getStaticPrefix()

Returns the static prefix of a glob.

private static getStaticPrefix(string $glob) : string

The "static prefix" is the part of the glob up to the first wildcard "*". If the glob does not contain wildcards, the full glob is returned.

Parameters
$glob : string

The canonical glob. The glob should contain forward slashes as directory separators only. It must not contain any "." or ".." segments.

Tags
psalm-pure
Return values
string

The static prefix of the glob.

getTotalPrefix()

private static getTotalPrefix(string $glob) : string|null
Parameters
$glob : string
Return values
string|null

isRecursiveWildcard()

Checks if the current position the glob is start of a Recursive directory wildcard

private static isRecursiveWildcard(string $glob, int $i) : bool
Parameters
$glob : string
$i : int
Tags
psalm-pure
Return values
bool

scanBackslashSequence()

private static scanBackslashSequence(string $glob, int $offset) : array<string|int, mixed>
Parameters
$glob : string
$offset : int
Tags
psalm-return

array{0: string, 1:int}

psalm-pure
Return values
array<string|int, mixed>

toRegEx()

Converts a glob to a regular expression.

private static toRegEx(string $glob) : string
Parameters
$glob : string

The canonical glob. The glob should contain forward slashes as directory separators only. It must not contain any "." or ".." segments.

Tags
psalm-pure
Return values
string

The regular expression for matching the glob.

Search results