class CaseImplementation extends AbstractArrayFusionObject (View source)

Case Fusion Object

The "case" Fusion object renders its children in order. The first result which is not MATCH_NORESULT is returned.

Often, this Fusion object is used together with the "Matcher" Fusion object; and all its children are by-default interpreted as "Matcher" Fusion objects if no others are specified.

Constants

MATCH_NORESULT

This constant should be returned by individual matchers if the matcher did not match.

You should not rely on the contents or type of this constant.

Properties

protected Runtime $runtime from  AbstractFusionObject
protected string $path

The Fusion path currently being rendered

from  AbstractFusionObject
protected string $fusionObjectName

Name of this Fusion object, like Neos.Neos:Text

from  AbstractFusionObject
protected array $fusionValueCache from  AbstractFusionObject
protected array internal $properties

List of properties which have been set using array access. We store this for every Fusion object in order to do things like: x = Foo { a = 'foo' b = ${this.a + 'bar'} }

from  AbstractArrayFusionObject
protected array $ignoreProperties

If you iterate over "properties" these in here should usually be ignored. For example additional properties in "Case" that are not "Matchers".

from  AbstractArrayFusionObject

Methods

__construct(Runtime $runtime, string $path, string $fusionObjectName)

Constructor

mixed
evaluate()

Execute each matcher until the first one matches

getRuntime()

Get the Fusion runtime this object was created in.

mixed
fusionValue(string $path)

Return the Fusion value relative to this Fusion object (with processors etc applied).

bool
offsetExists(mixed $offset)

No description

mixed
offsetGet(mixed $offset)

No description

void
offsetSet(mixed $offset, mixed $value)

No description

void
offsetUnset(mixed $offset)

No description

void
setIgnoreProperties(array $ignoreProperties = [])

No description

bool
shouldSortProperties()

Checks wether this Array fusion object should have sorted properties (according to __meta.position) or not

array
evaluateNestedProperties(string|null $defaultFusionPrototypeName = null)

No description

array
sortNestedProperties() deprecated

Sort the Fusion objects inside $this->properties depending on:

  • numerical ordering
  • position meta-property

array
preparePropertyKeys(array $properties, array $ignoredProperties)

No description

array
applyPositionalArraySorterToProperties(array $properties)

No description

array
filterIgnoredProperties(array $properties, array $ignoredProperties)

Filters properties by ignoredProperties

bool
isUntyped(string|int $key)

Returns TRUE if the given fusion key has no type, meaning neither having a fusion objectType, eelExpression or value

string
renderMatcher(string $matcherKey)

Render the given matcher

bool
matcherMatched(string $renderedMatcher)

Test whether the output of the matcher does not equal the MATCH_NORESULT

Details

__construct(Runtime $runtime, string $path, string $fusionObjectName)

Constructor

Parameters

Runtime $runtime
string $path
string $fusionObjectName

mixed evaluate()

Execute each matcher until the first one matches

Return Value

mixed

Runtime getRuntime()

Get the Fusion runtime this object was created in.

Return Value

Runtime

protected mixed fusionValue(string $path)

Return the Fusion value relative to this Fusion object (with processors etc applied).

Note that subsequent calls of fusionValue() with the same Fusion path will return the same values since the first evaluated value will be cached in memory.

Parameters

string $path

Return Value

mixed

bool offsetExists(mixed $offset)

No description

Parameters

mixed $offset

Return Value

bool

mixed offsetGet(mixed $offset)

No description

Parameters

mixed $offset

Return Value

mixed

void offsetSet(mixed $offset, mixed $value)

No description

Parameters

mixed $offset
mixed $value

Return Value

void

void offsetUnset(mixed $offset)

No description

Parameters

mixed $offset

Return Value

void

void setIgnoreProperties(array $ignoreProperties = [])

No description

Parameters

array $ignoreProperties

Return Value

void

bool shouldSortProperties()

Checks wether this Array fusion object should have sorted properties (according to __meta.position) or not

Return Value

bool

See also

applyPositionalArraySorterToProperties

protected array evaluateNestedProperties(string|null $defaultFusionPrototypeName = null)

No description

Parameters

string|null $defaultFusionPrototypeName

Return Value

array

Exceptions

Exception
InvalidConfigurationException
StopActionException
Exception

protected array sortNestedProperties() deprecated

deprecated

Sort the Fusion objects inside $this->properties depending on:

  • numerical ordering
  • position meta-property

This will ignore all properties defined in "@ignoreProperties" in Fusion

Return Value

array

an ordered list of key value pairs

Exceptions

Exception

See also

PositionalArraySorter
preparePropertyKeys()

protected array preparePropertyKeys(array $properties, array $ignoredProperties)

No description

Parameters

array $properties
array $ignoredProperties

Return Value

array

Fusion keys in this Array fusion object

Exceptions

Exception

protected array applyPositionalArraySorterToProperties(array $properties)

No description

Parameters

array $properties

Return Value

array

Exceptions

Exception

protected array filterIgnoredProperties(array $properties, array $ignoredProperties)

Filters properties by ignoredProperties

Parameters

array $properties
array $ignoredProperties

Return Value

array

protected bool isUntyped(string|int $key)

Returns TRUE if the given fusion key has no type, meaning neither having a fusion objectType, eelExpression or value

Parameters

string|int $key

fusion child key path to check

Return Value

bool

protected string renderMatcher(string $matcherKey)

Render the given matcher

A result value of MATCH_NORESULT means that the condition of the matcher did not match and the case should continue.

Parameters

string $matcherKey

Return Value

string

Exceptions

UnsupportedObjectTypeAtPathException

protected bool matcherMatched(string $renderedMatcher)

Test whether the output of the matcher does not equal the MATCH_NORESULT

If the debug mode is enabled, we have to strip the debug output before comparing the rendered result.

Parameters

string $renderedMatcher

Return Value

bool