Filters: Difference between revisions

From Sunhill Framework Documentation
+Incomplete
Page updated
 
Line 1: Line 1:
{{Incomplete}}
== What are Filters? ==
== What are Filters? ==
Filters are a series of method that are performed on a sepcialized container object when certain conditions are met.
Filters are a series of method that are performed on a sepcialized container object when certain conditions are met.
== The filter container ==
Filters are always performed on an filter container. This is a specialized class that acts like an array and stores several conditions. These conditions are checked by the filter. If all match the execute() method is called.
=== hasCondition(string $name): bool ===
Returns true when the given condition is defined in this container.
=== conditionWriteable(string $name): bool ===
Returns true when the given condition may be overwritten by a filter.
=== getCondition(string $name) ===
Returns the given condition.
=== setCondition(string $name, $value = true) ===
Sets the given condition.
== The filter class ==
=== setContainer(FilterContainer $container): static ===
=== addCondition(string $name, $condition) ===
=== addAlternativeCondition(array $condition) ===
=== matches(?FilterContainer $container = null): bool ===
=== execute(): string ===
For more information see [[Writing own filters|here]].
== The filters facade ==
For more Information see [[Filters facade|here]].
[[Category:Filters]]

Latest revision as of 08:47, 7 October 2024

What are Filters?

Filters are a series of method that are performed on a sepcialized container object when certain conditions are met.

The filter container

Filters are always performed on an filter container. This is a specialized class that acts like an array and stores several conditions. These conditions are checked by the filter. If all match the execute() method is called.

hasCondition(string $name): bool

Returns true when the given condition is defined in this container.

conditionWriteable(string $name): bool

Returns true when the given condition may be overwritten by a filter.

getCondition(string $name)

Returns the given condition.

setCondition(string $name, $value = true)

Sets the given condition.

The filter class

setContainer(FilterContainer $container): static

addCondition(string $name, $condition)

addAlternativeCondition(array $condition)

matches(?FilterContainer $container = null): bool

execute(): string

For more information see here.

The filters facade

For more Information see here.