Predicate
in package
implements
PredicateInterface
FinalYes
Closure based {@see PredicateInterface} with named constructors for the common conditions.
Tags
Table of Contents
Interfaces
- PredicateInterface
- A condition of a {@see ComposableRuleBased} rule.
Properties
- $description : string
- $fn : Closure
Methods
- __construct() : mixed
- __toString() : string
- and() : self
- anySpan() : self
- attributePatterns() : self
- Matches when the attribute is present, its string representation matches one of the included patterns (any value if there are none) and none of the excluded patterns. Patterns are case-sensitive, `?` matches a single character and `*` any sequence of characters. For array attributes, a match of any item is a match.
- attributeValues() : self
- Matches when the attribute is present and its string representation equals one of the values.
- attributeValueToString() : string
- Booleans are compared as "true" and "false", everything else by its string cast.
- hasLocalSpanParent() : self
- Matches spans with a valid, local parent. Root spans do not match.
- hasRemoteParent() : self
- isRootSpan() : self
- Matches spans without a valid parent span context.
- or() : self
- spanKindIn() : self
- spanMatches() : bool
- attributeStrings() : array<int, string>
- describe() : string
- matchesAny() : bool
- wildcardToRegex() : non-empty-string
Properties
$description read-only
private
string
$description
= ''
$fn read-only
private
Closure
$fn
Methods
__construct()
public
__construct(callable(ContextInterface, string, int, AttributesInterface, array<int, LinkInterface>): bool $fn[, string $description = '' ]) : mixed
Parameters
- $fn : callable(ContextInterface, string, int, AttributesInterface, array<int, LinkInterface>): bool
- $description : string = ''
__toString()
public
__toString() : string
Return values
stringand()
public
static and(PredicateInterface $p1, PredicateInterface $p2) : self
Parameters
- $p1 : PredicateInterface
- $p2 : PredicateInterface
Return values
selfanySpan()
public
static anySpan() : self
Return values
selfattributePatterns()
Matches when the attribute is present, its string representation matches one of the included patterns (any value if there are none) and none of the excluded patterns. Patterns are case-sensitive, `?` matches a single character and `*` any sequence of characters. For array attributes, a match of any item is a match.
public
static attributePatterns(string $key[, array<int, string> $included = [] ][, array<int, string> $excluded = [] ]) : self
Parameters
- $key : string
- $included : array<int, string> = []
- $excluded : array<int, string> = []
Return values
selfattributeValues()
Matches when the attribute is present and its string representation equals one of the values.
public
static attributeValues(string $key, array<int, string> $values) : self
For array attributes, a match of any item is a match.
Parameters
- $key : string
- $values : array<int, string>
Return values
selfattributeValueToString()
Booleans are compared as "true" and "false", everything else by its string cast.
public
static attributeValueToString(mixed $value) : string
Parameters
- $value : mixed
Return values
stringhasLocalSpanParent()
Matches spans with a valid, local parent. Root spans do not match.
public
static hasLocalSpanParent() : self
Return values
selfhasRemoteParent()
public
static hasRemoteParent() : self
Return values
selfisRootSpan()
Matches spans without a valid parent span context.
public
static isRootSpan() : self
Return values
selfor()
public
static or(PredicateInterface $p1, PredicateInterface $p2) : self
Parameters
- $p1 : PredicateInterface
- $p2 : PredicateInterface
Return values
selfspanKindIn()
public
static spanKindIn(int ...$spanKinds) : self
Parameters
- $spanKinds : int
Return values
selfspanMatches()
public
spanMatches(ContextInterface $parentContext, string $spanName, int $spanKind, AttributesInterface $attributes, array<string|int, mixed> $links) : bool
Parameters
- $parentContext : ContextInterface
- $spanName : string
- $spanKind : int
- $attributes : AttributesInterface
- $links : array<string|int, mixed>
Attributes
- #[Override]
Return values
boolattributeStrings()
private
static attributeStrings(AttributesInterface $attributes, string $key) : array<int, string>
Parameters
- $attributes : AttributesInterface
- $key : string
Return values
array<int, string>describe()
private
static describe(PredicateInterface $p) : string
Parameters
- $p : PredicateInterface
Return values
stringmatchesAny()
private
static matchesAny(array<int, non-empty-string> $regexes, string $candidate, bool $defaultIfEmpty) : bool
Parameters
- $regexes : array<int, non-empty-string>
- $candidate : string
- $defaultIfEmpty : bool
Return values
boolwildcardToRegex()
private
static wildcardToRegex(string $pattern) : non-empty-string
Parameters
- $pattern : string