Base
Less than 1 minute
Base
Abstract base class for model attribute rules.
class Base implements \Hazaar\Model\Attribute\AttributeRuleProvides 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): boolParameters
| 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, ?string $context): boolParameters
| 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 | string | Optional serialization context (e.g., format or target). |
getReason
Returns a human-readable reason for attribute rule failure.
public getReason(): stringGenerated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:23 +0000