PHP 클래스 Neos\Eel\FlowQuery\FlowQuery

It is specifically implemented for being used inside Eel, the Embedded Expression Language for Flow. Essentially, a FlowQuery object is a container for an *ordered set* of objects of a certain type. On this container, *operations* can be applied (like filter(), children(), ...). All of these operations work on a *set*, that is, an operation usually expands or shrinks the set of objects. An operation normally returns a new FlowQuery instance with the operation applied, but there are also some operations like is(...) or count(), which return simple types like boolean or numbers. We call these operations *final operations*. Internal Workings ================= To allow for optimization, calling operations are not immediately executed. Instead, they are appended to a *list of operations*. Only if one tries to iterate over the FlowQuery object or calls a final operation, the operations get executed and the result is computed. Implementation of Operations ---------------------------- Operations are implemented by implementing the {@link OperationInterface} or, more commonly, subclassing the {@link Operations/AbstractOperation}. An operation must be *equivalence preserving*, that is, the following equation must always hold: applyAllOperations(context) = applyRemainingOperations(applyOperation(context)) While an operation is running, it can *add new operations* to the front of the operation queue (with {@link pushOperation()}), so for example count($filter) can first apply filter($filter), followed by count(). However, when doing this, great care must be applied by the operation developer in order to still have finite runs, and to make sure the operation is *equivalence preserving*. Furthermore, an operation can *pop* its following operations from the operation stack, and *peek* what the next operation is. It is up to the operation developer to ensure equivalence preservation. An operation may *never* invoke __call() on the FlowQuery object it receives; as this might lead to an undefined state; i.e. you are not allowed to do: $flowQuery->someOtherOperation() *inside* an operation. Final Operations ---------------- If an operation is final, it should return the resulting value directly.
상속: implements Neos\Eel\ProtectedContextAwareInterface, implements IteratorAggregate, implements Countable
파일 보기 프로젝트 열기: neos/flow-development-collection 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$context array | Traversable the objects this FlowQuery object wraps
$operationResolver Neos\Eel\FlowQuery\OperationResolverInterface
$operations array ..', 'arguments' => array(...)) whereas the name is a string like 'children' and the arguments are a numerically-indexed array

공개 메소드들

메소드 설명
__call ( string $operationName, array $arguments ) : FlowQuery Add a new operation to the operation list and return the new FlowQuery object. If the operation is final, we directly compute the result and return the value.
__construct ( array | Traversable $context, array $operations = [] ) Construct a new FlowQuery object from $context and $operations.
allowsCallOfMethod ( string $methodName ) : boolean
count ( ) : integer Implementation of the countable() interface, which is mapped to the "count" operation.
getContext ( ) : array | Traversable Get the current context.
getIterator ( ) : ArrayIterator Called when iterating over this FlowQuery object, triggers evaluation.
peekOperationName ( ) : string Peek onto the next operation name, if any, or NULL otherwise.
popOperation ( ) : array Pop the topmost operation from the stack and return it; i.e. the operation which should be executed next. The returned array has the form: array('name' => '.
pushOperation ( string $operationName, array $arguments ) Push a new operation onto the operations stack.
setContext ( array | Traversable $context ) Set the updated context with the operation result applied.
setOperationResolver ( Neos\Eel\FlowQuery\OperationResolverInterface $operationResolver ) Setter for setting the operation resolver from the outside, only needed to successfully run unit tests (hacky!)

보호된 메소드들

메소드 설명
evaluateOperations ( ) : mixed Evaluate operations

메소드 상세

__call() 공개 메소드

Add a new operation to the operation list and return the new FlowQuery object. If the operation is final, we directly compute the result and return the value.
public __call ( string $operationName, array $arguments ) : FlowQuery
$operationName string
$arguments array
리턴 FlowQuery

__construct() 공개 메소드

Only the $context parameter belongs to the public API! If a FlowQuery is given as the $context we unwrap its context to assert q(q(context)) == q(context).
public __construct ( array | Traversable $context, array $operations = [] )
$context array | Traversable The initial context (wrapped objects) for this FlowQuery
$operations array

allowsCallOfMethod() 공개 메소드

public allowsCallOfMethod ( string $methodName ) : boolean
$methodName string
리턴 boolean

count() 공개 메소드

Implementation of the countable() interface, which is mapped to the "count" operation.
public count ( ) : integer
리턴 integer

evaluateOperations() 보호된 메소드

Evaluate operations
protected evaluateOperations ( ) : mixed
리턴 mixed the last operation result if the operation is a final operation, NULL otherwise

getContext() 공개 메소드

Should only be called inside an operation.
public getContext ( ) : array | Traversable
리턴 array | Traversable

getIterator() 공개 메소드

Should NEVER be called inside an operation!

peekOperationName() 공개 메소드

Should only be called inside an operation.
public peekOperationName ( ) : string
리턴 string the next operation name or NULL if no next operation found.

popOperation() 공개 메소드

..', 'arguments' => array(...)) Should only be called inside an operation.
public popOperation ( ) : array
리턴 array

pushOperation() 공개 메소드

The last-pushed operation is executed FIRST! (LIFO) Should only be called inside an operation.
public pushOperation ( string $operationName, array $arguments )
$operationName string
$arguments array

setContext() 공개 메소드

Should only be called inside an operation.
public setContext ( array | Traversable $context )
$context array | Traversable

setOperationResolver() 공개 메소드

Setter for setting the operation resolver from the outside, only needed to successfully run unit tests (hacky!)
public setOperationResolver ( Neos\Eel\FlowQuery\OperationResolverInterface $operationResolver )
$operationResolver Neos\Eel\FlowQuery\OperationResolverInterface

프로퍼티 상세

$context 보호되어 있는 프로퍼티

the objects this FlowQuery object wraps
protected array|Traversable $context
리턴 array | Traversable

$operationResolver 보호되어 있는 프로퍼티

protected OperationResolverInterface,Neos\Eel\FlowQuery $operationResolver
리턴 Neos\Eel\FlowQuery\OperationResolverInterface

$operations 보호되어 있는 프로퍼티

..', 'arguments' => array(...)) whereas the name is a string like 'children' and the arguments are a numerically-indexed array
protected array $operations
리턴 array