Class ExpressionAssertion

Summary

Fully Qualified Name: Zend\Permissions\Acl\Assertion\ExpressionAssertion
Implements: AssertionInterface

Description

Create an assertion based on expression rules.

Each of the constructor, fromProperties, and fromArray methods allow you to define expression rules, and these include the left hand side, operator, and right hand side of the expression.

The left and right hand sides of the expression are the values to compare. These values can be either an exact value to match, or an array with the key OPERAND_CONTEXT_PROPERTY pointing to one of two value types.

First, it can be a string value matching one of "acl", "privilege", "role", or "resource", with the latter two values being the most common. In those cases, the matching value passed to assert() will be used in the comparison.

Second, it can be a dot-separated property path string of the format "object.property", representing the associated object (role, resource, acl, or privilege) and its property to test against. The property may refer to a public property, or a public get or is method (following canonicalization of the property by replacing underscore separated values with camelCase values).

Methods

Name Description Defined By
assert() {@inheritDoc} ExpressionAssertion
fromArray() ExpressionAssertion
fromProperties() ExpressionAssertion

Method Details

assert()

{@inheritDoc}

Parameter Name Type Description
$acl
$role
$resource
$privilege

Returns:

fromArray()

Parameter Name Type Description
$expression array Must

Returns: self

fromProperties()

Parameter Name Type Description
$left mixed|array See
$operator string One
$right mixed|array See

Returns: self

Top