SlotFlow API Documentation

RuleSet
in package

FinalYes

Composable container for slot and edge rules.

Tags
template

Table of Contents

Properties

$rules  : array<string|int, mixed>

Methods

__construct()  : mixed
Create one possibly nested rule-set container.
all()  : array<int, EdgeRule>|array<int, SlotRule>
Recursively flatten the RuleSet and return all rules as a single array.
from()  : self
Create one rule set from individual rules or nested rule sets.
meta()  : self
Apply $attribute metadata to all rules in the RuleSet.

Properties

$rules

public array<string|int, mixed> $rules

Methods

__construct()

Create one possibly nested rule-set container.

public __construct(array<string|int, SlotRule|EdgeRule|RuleSet$rules) : mixed
Parameters
$rules : array<string|int, SlotRule|EdgeRule|RuleSet>
Tags
psalm-param

array<TRuleType|RuleSet<TRuleType>> $rules

all()

Recursively flatten the RuleSet and return all rules as a single array.

public all() : array<int, EdgeRule>|array<int, SlotRule>
Tags
psalm-return

list<TRuleType>

Return values
array<int, EdgeRule>|array<int, SlotRule>

a flat list of all rules contained in the RuleSet, including those in nested RuleSets

from()

Create one rule set from individual rules or nested rule sets.

public static from(SlotRule|EdgeRule|RuleSet ...$rules) : self
Parameters
$rules : SlotRule|EdgeRule|RuleSet
Tags
template
psalm-param

TFromRuleType|RuleSet<TFromRuleType> ...$rules

psalm-return

self<TFromRuleType>

Return values
self

meta()

Apply $attribute metadata to all rules in the RuleSet.

public meta(array<string, mixed> $attributes) : self

This method recursively applies the metadata to any nested RuleSets as well.

Parameters
$attributes : array<string, mixed>

The metadata attributes to apply

Tags
psalm-return

self<TRuleType>

Return values
self

A new RuleSet instance with the metadata applied to all contained rules


        
On this page

Search results