This abstract class - when inerith - add a more efficent management of properties. WPDKObject is the root class of most WPDK class hierarchies. Through WPDKObject, objects inherit a basic interface to the runtime system and the ability to behave as WPDK objects.
Author: =undo= (info@wpxtre.me)
示例#1
0
 /**
  * Do a merge/combine between two object tree.
  * If the old version not contains an object or property, that is added.
  * If the old version contains an object or property less in last version, that is deleted.
  *
  * @brief      Object delta compare for combine
  *
  * @param mixed $last_version Object tree with new or delete object/value
  * @param mixed $old_version  Current Object tree, loaded from serialize or database for example
  *
  * @return Object the delta Object tree
  *
  * @deprecated Since 1.2.0 Use WPDKObject::__delta() instead
  */
 function wpdk_delta_object($last_version, $old_version)
 {
     _deprecated_function(__FUNCTION__, '1.2.0', 'WPDKObject::__delta()');
     return WPDKObject::__delta($last_version, $old_version);
 }
示例#2
0
 /**
  * Do a delta compare/combine from two tree object config
  *
  * @brief Delta (align) object
  *
  * @return object
  */
 public function delta()
 {
     // Check if exists a store version
     $store_version = $this->get();
     // Get subclass name
     $subclass_name = get_class($this);
     // Prepare an onfly instance
     $delta = $instance = new $subclass_name($this->name);
     if (!empty($store_version)) {
         // In rare case could happen that the stored class is different from onfly class
         if (!is_a($store_version, $subclass_name)) {
             $this->delete();
             call_user_func(array($instance, 'update'));
         } else {
             $delta = WPDKObject::__delta($instance, $store_version);
             $delta->update();
         }
     }
     return $delta;
 }