Oihana PHP System

hydrateAppointmentStatus.php

Table of Contents

Functions

hydrateAppointmentStatus()  : mixed
Hydrate an array definition with the member class of {@see AppointmentStatus} it names.

Functions

hydrateAppointmentStatus()

Hydrate an array definition with the member class of {@see AppointmentStatus} it names.

hydrateAppointmentStatus([mixed $init = null ]) : mixed

The twin of hydrateEventStatus(), on the other axis : that one says what became of the slot, this one what became of the meeting. Both are read back the same way, so a consumer holding a stored appointment does not have to treat them differently.

A status is written one of two ways : the bare constant, when there is nothing more to say, or the member class, when there is — new AppointmentNoShow([ 'description' => '…' ]) says what was found on the doorstep, and a string cannot.

🔑 The bare constant comes back untouched. It is not an array, so it falls through the first guard : whichever form was stored can be handed to this helper.

The member is resolved by findEnumerationMember(), from the payload's additionalType — the URI every member states of itself — then from its @type, which carries the short name.

⚠️ The two never coincide here, unlike on the Schema.org side : this vocabulary spells its members …/AppointmentStatus#NoShow while the class is named AppointmentNoShow, so neither key can be derived from the other — which is precisely why the URI is stated by the member rather than read off its class name.

Nothing recognized gives an AppointmentStatus : the status is unknown to this vocabulary, and answering null would throw away the reason it carried.

🔑 A bare reference survives inside a list, exactly as it does on its own : a list of unresolved handles comes back as it stands, and only an entry that was an array and resolved to nothing is dropped. The keys stay gap-free — a filtered list left with holes serializes as a JSON object, and a consumer walking the value gets something it cannot walk.

Parameters
$init : mixed = null

Single status data, a list of such data, or any other value.

Tags
throws
ReflectionException
example
hydrateAppointmentStatus( AppointmentStatus::DONE ) ;                        // the string, untouched
hydrateAppointmentStatus( [ '@type' => 'AppointmentNoShow' ] ) ;              // AppointmentNoShow
hydrateAppointmentStatus( [ 'additionalType' => AppointmentStatus::DONE ] ) ; // AppointmentDone
On this page

Search results