Base
Less than 1 minute
Base
Abstract base class for model attribute rules.
class Base implements \Hazaar\Model\Interface\AttributeRuleImplements: Hazaar\Model\Interface\AttributeRule
Provides default implementations for attribute evaluation, serialization, and error reason reporting. Extend this class to implement custom attribute validation and serialization logic for Hazaar models.
Methods
evaluate
Evaluates the value of a model property against this attribute rule.
public evaluate(mixed $propertyValue, \ReflectionProperty $property): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$propertyValue | mixed | the value of the property to evaluate (passed by reference) |
$property | ReflectionProperty | the reflection property instance for metadata (passed by reference) |
serialize
Serializes the property value for output or storage, applying this attribute rule.
public serialize(mixed $propertyValue, \ReflectionProperty $property, ?array $context): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$propertyValue | mixed | the value of the property to serialize (passed by reference) |
$property | ReflectionProperty | the reflection property instance for metadata (passed by reference) |
$context | array | Optional serialization context(s) (e.g., format or target). |
getReason
Returns a human-readable reason for attribute rule failure.
public getReason(): stringReturns: string
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:17 +0000