Data objects are used in TeqFW as improved \srdClass
objects.
Prevent warnings if some property is not set yet:
stdClass:
$data = new \stdClass();
$val = $data->prop;
// PHP Notice: Undefined property: stdClass::$prop in ...
Data object:
$data = new \TeqFw\Lib\Data();
$val = $data->prop; // $val = null
stdClass:
$data = new \stdClass();
$data->path = new \stdClass();
$data->path->to = new \stdClass();
$data->path->to->node = 'value';
$val = $data->path->to->node; // $val = 'value'
Data object:
$data = new \TeqFw\Lib\Data();
$data->set('path/to/node', 'value');
$val = $data->get('path/to/node'); // $val = 'value'
$param = [
'key1' => 'value1',
'key2' => 'value2'
];
$obj = new \TeqFw\Lib\Data($param);
$val1 = $obj->key1; // $val1 = 'value1'
$val2 = $obj->key2; // $val2 = 'value2'