PDMProperty - Thouvvv/PlayerDataManager GitHub Wiki
Instances of \Thouv\PDM\PDMProperty are where the data assigned to instances of PDMPlayer is stored. These properties can also contain flags to identify their characteristics.
Constructor
public function __construct(string $property_name, $value, array $flags = null)
$property_name string
This is the name of the property and is used to identify the instance.
$value
This is the value assigned to the property. It contains the "payload."
$flags array
These are the flags that can be used to give the property characteristics. They are in the form [flag_name => flag_value].
PDMProperty::getPropertyName()
This returns the property's name.
PDMProperty::getValue()
This returns the property's value.
Flags
The flags property of the PDMProperty class is an array in the form flag_name => flag_value. A flag is simply a key-value pair. Flags can be used to give characteristics to a property. This is especially useful when selecting properties based on their flags using PDMPlayer::getProperties(). The only reserved flag is no_sync, which is used to bypass a player's sync property. When set to false, the no_sync flag can disable the synchronization of a property despite a player have synchronization turned on. (See PDMProperty::toSyncOrNotToSync()).
PDMProperty::setFlag()
public function setFlag(string $flag_name, $flag_value)
$flag_name string
The name of the flag that will be set.
$flag_value
The value of the flag that will be set.
PDMProperty::getFlag()
public function getFlag(string $flag_name)
$flag_name string
The name of the flag that will be returned.
This returns the specified flag's value, or null if it doesn't exist.
PDMProperty::toSyncOrNotToSync()
This returns true if a property should be synchronized with the provider, false otherwise. This will only return false if the no_sync flag is strictly equal to true.
PDMProperty::toArray()
This returns an array in the form [property_name => [property_value, "flags" => [flag_name1 => flag_value1, flag_name2 => flag_value2, ...]]].