CompositeExpression
in package
implements
Countable
Composite expression is responsible to build a group of similar expression.
Table of Contents
Interfaces
- Countable
Constants
- TYPE_AND = 'AND'
- Constant that represents an AND composite expression.
- TYPE_OR = 'OR'
- Constant that represents an OR composite expression.
Properties
- $parts : array<string|int, self>|array<string|int, string>
- Each expression part of the composite expression.
- $type : string
- The instance type of composite expression.
Methods
- __toString() : string
- Retrieves the string representation of this composite expression.
- add() : CompositeExpression
- Adds an expression to composite expression.
- addMultiple() : CompositeExpression
- Adds multiple parts to composite expression.
- and() : self
- count() : int
- Retrieves the amount of expressions on composite expression.
- getType() : string
- Returns the type of this composite expression (AND/OR).
- or() : self
- with() : self
- Returns a new CompositeExpression with the given parts added.
Constants
TYPE_AND
Constant that represents an AND composite expression.
public
mixed
TYPE_AND
= 'AND'
TYPE_OR
Constant that represents an OR composite expression.
public
mixed
TYPE_OR
= 'OR'
Properties
$parts
Each expression part of the composite expression.
private
array<string|int, self>|array<string|int, string>
$parts
= []
$type
The instance type of composite expression.
private
string
$type
Methods
__toString()
Retrieves the string representation of this composite expression.
public
__toString() : string
Return values
stringadd()
Adds an expression to composite expression.
public
add(mixed $part) : CompositeExpression
Parameters
- $part : mixed
Tags
Return values
CompositeExpressionaddMultiple()
Adds multiple parts to composite expression.
public
addMultiple([array<string|int, self>|array<string|int, string> $parts = [] ]) : CompositeExpression
Parameters
- $parts : array<string|int, self>|array<string|int, string> = []
Tags
Return values
CompositeExpressionand()
public
static and(self|string $part, self|string ...$parts) : self
Parameters
- $part : self|string
- $parts : self|string
Return values
selfcount()
Retrieves the amount of expressions on composite expression.
public
count() : int
Return values
intgetType()
Returns the type of this composite expression (AND/OR).
public
getType() : string
Return values
stringor()
public
static or(self|string $part, self|string ...$parts) : self
Parameters
- $part : self|string
- $parts : self|string
Return values
selfwith()
Returns a new CompositeExpression with the given parts added.
public
with(self|string $part, self|string ...$parts) : self
Parameters
- $part : self|string
- $parts : self|string