Login   Register  
PHP Classes

File: examples/kernel/core/TObject/resetProperties.php

Recommend this page to a friend!
  Classes of ASCOOS CMS   Ascoos OS   examples/kernel/core/TObject/resetProperties.php   Download  
File: examples/kernel/core/TObject/resetProperties.php
Role: Example script
Content typex: text/plain
Description: Example script
Class: Ascoos OS
A PHP Web 5.0 Kernel for decentralized web and IoT
Author: By
Last change: Update of examples/kernel/core/TObject/resetProperties.php
Date: 1 month ago
Size: 1,840 bytes
 

Contents

Class file image Download
<?php
/**
 * @ASCOOS-NAME : Ascoos OS
 * @ASCOOS-VERSION : 26.0.0
 * @ASCOOS-SUPPORT : [email protected]
 * @ASCOOS-BUGS : https://issues.ascoos.com
 *
 * @desc <English> Demonstrates resetting object properties using the resetProperties method.
 * @desc <Greek> ??????????? ??? ????????? ????????? ???????????? ??????????????? ?? ?????? resetProperties.
 *
 * @since PHP 8.2.0
 */

use ASCOOS\OS\Kernel\Core\TObject;

// <English> Initialize properties array with configuration
// <Greek> ???????????? ?????? ????????? ?? ??????????
$initialProperties = [
   
'name' => 'TestObject',
   
'version' => 260000
];

// <English> Create a new TObject instance
// <Greek> ?????????? ???? instance ??? TObject
$object = new TObject($initialProperties);

// <English> Update properties
// <Greek> ????????? ?????????
$object->setProperty('name', 'UpdatedObject');
$object->setProperty('version', 260001);

// <English> Reset properties to initial state
// <Greek> ????????? ????????? ???? ?????? ?????????
$success = $object->resetProperties($initialProperties);
// <English> Output reset result
// <Greek> ???????? ????????????? ??????????
echo $success ? "Properties reset successfully\n" : "Failed to reset properties\n"; // Outputs: Properties reset successfully

// <English> Output current properties
// <Greek> ???????? ????????? ?????????
print_r($object->getProperties()); // Outputs: ['name' => 'TestObject', 'version' => 260000]

// <English> Free resources
// <Greek> ???????????? ?????
$object->Free($object);
?>