Documentation

Property
in package

Contains a property value. The value can be fetched as a generic Object or one of the convenience methods can be used to get the value in a specific type.

Tags
copyright

Copyright (c) DeviceAtlas Limited 2023. All Rights Reserved.

author

DeviceAtlas Limited

Table of Contents

Properties

$dTI  : mixed
$iCOV  : mixed
$v  : mixed
$NOT_CONVERTIBLE_TO_BOOLEAN  : mixed
$NOT_CONVERTIBLE_TO_INT  : mixed

Methods

__toString()  : string
Get the value of the property as a String. Alias for toString().
asBoolean()  : bool
Get the value of the property as a boolean.
asInteger()  : int
Get the value of the property as an int.
asSet()  : array<string|int, mixed>
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.
asString()  : string
Get the value of the property as a String. Alias for toString().
build()  : Property
buildCollectionOfValues()  : mixed
equals()  : bool
Compare two instances of this class.
getDataType()  : string
Get the data type name for values associated with this Property.
getDataTypeId()  : int
Get the data type ID for values associated with this Property.
toString()  : string
Get the value of the property as a String. Alias for asString() . If a property has multiple possible values then the values are concatenated with a comma.
value()  : object
Get the value Object. This needs to be cast to the appropriate type such as Integer to be used. E.g. $value = (int) $property->value();
__construct()  : mixed
Create a new Property with a value and data type.
getValueAsInteger()  : mixed

Properties

$NOT_CONVERTIBLE_TO_BOOLEAN

private static mixed $NOT_CONVERTIBLE_TO_BOOLEAN = 'Property is not convertible to a boolean.'

$NOT_CONVERTIBLE_TO_INT

private static mixed $NOT_CONVERTIBLE_TO_INT = 'Property is not convertible to an int.'

Methods

__toString()

Get the value of the property as a String. Alias for toString().

public __toString() : string
Return values
string —

The string value of the property

asBoolean()

Get the value of the property as a boolean.

public asBoolean() : bool
Tags
throws
IncorrectPropertyTypeException

Thrown if the type of the value is not a DataType::BOOLEAN

Return values
bool —

The boolean value of the property.

asInteger()

Get the value of the property as an int.

public asInteger() : int
Tags
throws
IncorrectPropertyTypeException

Thrown if the type of the value is not compatible with a DDataType::INTEGER

Return values
int —

The integer value of the property.

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.

public asSet() : array<string|int, mixed>
Return values
array<string|int, mixed> —

A set of values.

asString()

Get the value of the property as a String. Alias for toString().

public asString() : string
Return values
string —

The string value of the property

build()

public static build( $value,  $dataTypeId[,  $isCollectionOfValues = false ]) : Property
Parameters
$value :

string|bool|int|array The value to store

$dataTypeId :

int The type of the value to store. Data types are defined in class DataType.

$isCollectionOfValues : = false

bool Indicates if the Property will contain a single value or multiple values

Tags
throws
IncorrectPropertyTypeException
Return values
Property

buildCollectionOfValues()

public static buildCollectionOfValues(mixed $values, mixed $dataTypeId) : mixed
Parameters
$values : mixed
$dataTypeId : mixed

equals()

Compare two instances of this class.

public equals( $obj) : bool

If both have equal values and data type then returns true.

Parameters
$obj :

object to be compared against

Return values
bool —

Compare result

getDataType()

Get the data type name for values associated with this Property.

public getDataType() : string
Return values
string —

The name of the data type

getDataTypeId()

Get the data type ID for values associated with this Property.

public getDataTypeId() : int
Return values
int —

The ID of the data type

toString()

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

public toString() : string
Return values
string —

The string value of the property

value()

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

public value() : object
Return values
object —

The raw Object value.

__construct()

Create a new Property with a value and data type.

private __construct( $value,  $dataTypeId[,  $isCollectionOfValues = false ]) : mixed
Parameters
$value :

string|bool|int The value to store

$dataTypeId :

int The type of the value to store. Data types are defined in class DataType.

$isCollectionOfValues : = false

bool Indicates if the Property will contain a single value or multiple values

getValueAsInteger()

private static getValueAsInteger(mixed $stringValue) : mixed
Parameters
$stringValue : mixed

        
On this page

Search results