TOP

Mobi_Mtld_DA_Property

Contains a property value. The value can be fetched as a generic Object or one of the convenience asXXXX methods can be used to get the value in a specific type.
Source
Property.php
Depends on
Mobi_Mtld_DA_DataType
The
Mobi_Mtld_DA_Exception_IncorrectPropertyTypeException
A
Author
DeviceAtlas Limited

Methods

__construct

Mobi_Mtld_DA_Property $obj = new Mobi_Mtld_DA_Property(mixed value, byte dataTypeId)

Create a new Property with a value and data type.

Arguments

    value (mixed)
    The value to store
    dataTypeId (byte)
    The type of the value to store

Returns

void

__toString

The __toString()

Get the value of the property as string. Alias for asString(). If a property has multiple possible values then the values are concatenated with a comma.

Returns

The
string value of the property

asBoolean

The $obj->asBoolean()

Get the value of the property as a boolean.

Returns

The
boolean value of the property.

Throws

  • Mobi_Mtld_DA_Exception_IncorrectPropertyTypeException Thrown if the type of the value is not a Mobi_Mtld_DA_DataType::BOOLEAN

asInteger

The $obj->asInteger()

Get the value of the property as an integer.

Returns

The
integer value of the property.

Throws

  • Mobi_Mtld_DA_Exception_IncorrectPropertyTypeException Thrown if the type of the value is not compatible with a Mobi_Mtld_DA_DataType::INTEGER

asSet

A $obj->asSet()

Gets a set of possible values for this property. This is typically only used when it is known that a given property name can have multiple possible values. All items in the set will have the same data type.

Returns

A
set of values.

asString

The $obj->asString()

Get the value of the property as string. Alias for asString(). If a property has multiple possible values then the values are concatenated with a comma.

Returns

The
string value of the property.

equals

bool $obj->equals($obj object)

Compare two instances of this class. If both have equal values and data type then returns true.

Arguments

    object ($obj)
    to be compared against

Returns

bool
Compare result

getDataType

string $obj->getDataType()

Get the type name of this property. See Mobi_Mtld_DA_DataType for a full list of data types.

Returns

string
The data type name of this property.

getDataTypeId

byte $obj->getDataTypeId()

Get the type of this property. See Mobi_Mtld_DA_DataType for a full list of data types.

Returns

byte
The data type ID of this property.

toString

The $obj->toString()

Get the value of the property as string. Alias for asString(). If a property has multiple possible values then the values are concatenated with a comma.

Returns

The
string value of the property

value

The $obj->value()

Get the value of this property. This needs to be cast to the appropriate type such to be used. E.g. value = (int)$property->value();

Returns

The
raw property value.