Public Member Functions | |
__construct ($stream=null, $validate_stream_on_construct=true, $validate_properties=true, $validators=null, $validation_context=null) | |
getValidateProperties () | |
getValidateStreamOnConstruct () | |
getValidators () | |
getDoc () | |
getId () | |
setId ($value) | |
getType () | |
setType ($types) | |
getProperty ($prop_name) | |
setProperty ($prop_name, $value) | |
validate () | |
validateProperty ($prop_name, $value, $force_validate=false, $raise_error=true) | |
toJSONLD () | |
Protected Member Functions | |
_registerPropertyValidationError (ValidationError $ve, $prop_name, $value) | |
required (ValidationError $ve, $prop_name, $value) | |
requiredAndValidate (ValidationError $ve, $prop_name, $value) | |
optionalAndValidate (ValidationError $ve, $prop_name, $value) | |
Static Protected Member Functions | |
static | deepCopy ($array) |
Protected Attributes | |
$validateStreamOnConstruct | |
$validateProperties | |
$validators | |
$validationContext | |
$stream | |
Base class from which all Notify objects extend.
There are two kinds of Notify objects:
This class forms the basis for both of those types, and provides essential services, such as construction, accessors and validation, as well as supporting the essential properties "id" and "type"
coarnotify\core\notify\NotifyBase::__construct | ( | $stream = null, | |
$validate_stream_on_construct = true, | |||
$validate_properties = true, | |||
$validators = null, | |||
$validation_context = null ) |
Base constructor that all subclasses should call
mixed | $stream | The activity stream object, or an array from which one can be created |
bool | $validate_stream_on_construct | Should the incoming stream be validated at construction-time |
bool | $validate_properties | Should individual properties be validated as they are set |
Validator | null | $validators | The validator object for this class and all nested elements |
string | array | null | $validation_context | The context in which this object is being validated |
Reimplemented in coarnotify\core\notify\NotifyPattern, and coarnotify\core\notify\NotifyPatternPart.
|
protected |
Force validate the property and if an error is found, add it to the validation error
ValidationError | $ve | |
$prop_name | ||
$value |
ValueError |
coarnotify\core\notify\NotifyBase::getDoc | ( | ) |
The underlying activity stream document for this Notify object.
coarnotify\core\notify\NotifyBase::getProperty | ( | $prop_name | ) |
Generic property getter. It is strongly recommended that all accessors proxy for this function as this mediates directly with the underlying activity stream object.
$prop_name |
coarnotify\core\notify\NotifyBase::getValidateProperties | ( | ) |
Are properties being validated on set?
coarnotify\core\notify\NotifyBase::getValidateStreamOnConstruct | ( | ) |
Is the stream validated on construction?
coarnotify\core\notify\NotifyBase::getValidators | ( | ) |
The validator object for this instance
|
protected |
Validate the value if it is not null, but do not raise a validation error if it is null
ValidationError | $ve | |
$prop_name | ||
$value |
ValueError |
|
protected |
Add a required error to the validation error if the value is null
ValidationError | $ve | |
$prop_name | ||
$value |
|
protected |
Add a required error to the validation error if the value is null, and then validate the value if not.
Any error messages are added to the ValidationError
object
ValidationError | $ve | |
$prop_name | ||
$value |
ValueError |
coarnotify\core\notify\NotifyBase::setProperty | ( | $prop_name, | |
$value ) |
Generic property setter. It is strongly recommended that all accessors proxy for this function as this mediates directly with the underlying activity stream object.
$prop_name | |
$value |
ValueError |
coarnotify\core\notify\NotifyBase::validate | ( | ) |
Validate the object. This provides the basic validation on id
and type
. Subclasses should override this method with their own validation, and call this method via super
first to ensure the basic properties are validated.
ValidationError |
Reimplemented in coarnotify\core\notify\NotifyItem, coarnotify\core\notify\NotifyObject, coarnotify\core\notify\NotifyPattern, coarnotify\patterns\accept\Accept, coarnotify\patterns\announce_endorsement\AnnounceEndorsement, coarnotify\patterns\announce_endorsement\AnnounceEndorsementItem, coarnotify\patterns\announce_relationship\AnnounceRelationship, coarnotify\patterns\announce_relationship\AnnounceRelationshipObject, coarnotify\patterns\announce_review\AnnounceReview, coarnotify\patterns\announce_review\AnnounceReviewItem, coarnotify\patterns\announce_review\AnnounceReviewObject, coarnotify\patterns\announce_service_result\AnnounceServiceResult, coarnotify\patterns\announce_service_result\AnnounceServiceResultItem, coarnotify\patterns\announce_service_result\AnnounceServiceResultObject, coarnotify\patterns\reject\Reject, coarnotify\patterns\request_endorsement\RequestEndorsementItem, coarnotify\patterns\request_review\RequestReviewItem, coarnotify\patterns\tentatively_accept\TentativelyAccept, coarnotify\patterns\tentatively_reject\TentativelyReject, coarnotify\patterns\undo_offer\UndoOffer, and coarnotify\patterns\unprocessable_notification\UnprocessableNotification.
coarnotify\core\notify\NotifyBase::validateProperty | ( | $prop_name, | |
$value, | |||
$force_validate = false, | |||
$raise_error = true ) |
Validate a single property. This is used internally by setProperty
If the object has validate_properties
set to false
then that behaviour may be overridden by setting force_validate
to true
The validator applied to the property will be determined according to the validators
property of the object and the validation_context
of the object.
$prop_name | |
$value | |
$force_validate | |
$raise_error |
ValueError |