summaryrefslogtreecommitdiffstats
path: root/modules-available/locationinfo/exchange-includes/jamesiarmes/PhpEws/Type.php
diff options
context:
space:
mode:
authorroot2019-02-19 18:53:50 +0100
committerroot2019-02-19 18:53:50 +0100
commit0ad4c0f8196b61699754762aacbaab0223478ab9 (patch)
treede434c4aea8d07ecd01cd3badd48d057d62c2d1b /modules-available/locationinfo/exchange-includes/jamesiarmes/PhpEws/Type.php
parent[usb-lock-off] Edit rule cleanup and fix of the dropdown boxes. (diff)
parent[statistics] Fix RAM change warning to handle increase too (diff)
downloadslx-admin-usb-lock-off.tar.gz
slx-admin-usb-lock-off.tar.xz
slx-admin-usb-lock-off.zip
Merge branch 'master' into usb-lock-offusb-lock-off
Diffstat (limited to 'modules-available/locationinfo/exchange-includes/jamesiarmes/PhpEws/Type.php')
-rw-r--r--modules-available/locationinfo/exchange-includes/jamesiarmes/PhpEws/Type.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/modules-available/locationinfo/exchange-includes/jamesiarmes/PhpEws/Type.php b/modules-available/locationinfo/exchange-includes/jamesiarmes/PhpEws/Type.php
new file mode 100644
index 00000000..89a25556
--- /dev/null
+++ b/modules-available/locationinfo/exchange-includes/jamesiarmes/PhpEws/Type.php
@@ -0,0 +1,45 @@
+<?php
+/**
+ * Contains \jamesiarmes\PhpEws\Type.
+ */
+
+namespace jamesiarmes\PhpEws;
+
+/**
+ * Base class for Exchange Web Service Types.
+ *
+ * @package php-ews\Type
+ */
+abstract class Type
+{
+ /**
+ * Clones any object properties on a type object when it is cloned. Allows
+ * for a deep clone required when using object to represent data types when
+ * making a SOAP call.
+ */
+ public function __clone()
+ {
+ // Iterate over all properties on the current object.
+ foreach (get_object_vars($this) as $property => $value) {
+ // If the value of the property is an object then clone it.
+ if (is_object($value)) {
+ $this->$property = clone $value;
+ } elseif (is_array($value)) {
+ // The value is an array that may use objects as values. Iterate
+ // over the array and clone any values that are objects into a
+ // new array.
+ // For some reason, if we try to set $this->$property to an
+ // empty array then update it as we go it ends up being empty.
+ // If we use a new array that we then set as the value of
+ // $this->$property all is well.
+ $new_value = array();
+ foreach ($value as $index => $array_value) {
+ $new_value[$index] = (is_object($array_value) ? clone $array_value : $array_value);
+ }
+
+ // Set the property to the new array.
+ $this->$property = $new_value;
+ }
+ }
+ }
+}