<?php
/**
* @ASCOOS-NAME : Ascoos OS
* @ASCOOS-VERSION : 26.0.0
* @ASCOOS-SUPPORT : support@ascoos.com
* @ASCOOS-BUGS : https://issues.ascoos.com
*
* @desc <English> Demonstrates merging properties with different strategies using the mergeProperties method.
* @desc <Greek> ??????????? ?? ?????????? ????????? ?? ???????????? ??????????? ??????????????? ?? ?????? mergeProperties.
*
* @since PHP 8.2.0
*/
use ASCOOS\OS\Kernel\Core\TObject;
// <English> Declare global AOS_LOGS_PATH for log directory
// <Greek> ??????? ?? global ????????? AOS_LOGS_PATH ??? ??? ???????? ??????????
global $AOS_LOGS_PATH;
// <English> Initialize properties array with configuration
// <Greek> ???????????? ?????? ????????? ?? ??????????
$properties = [
'name' => 'TestObject',
'config' => ['host' => 'localhost']
];
// <English> Create a new TObject instance with properties
// <Greek> ?????????? ???? instance ??? TObject ?? ?????????
$object = new TObject($properties);
// <English> Define new properties to merge
// <Greek> ??????? ???? ????????? ??? ??????????
$newProperties = [
'config' => ['port' => 3306],
'version' => 260000
];
// <English> Merge properties with 'merge' strategy
// <Greek> ?????????? ????????? ?? ?? ?????????? 'merge'
$object->mergeProperties($newProperties, 'merge');
// <English> Output merged properties
// <Greek> ???????? ????????????? ?????????
print_r($object->getProperties()); // Outputs: ['name' => 'TestObject', 'config' => ['host' => 'localhost', 'port' => 3306], 'version' => 260000]
// <English> Free resources
// <Greek> ???????????? ?????
$object->Free($object);
?>
|