From b409fbb72591b43df7431e83e30d6c00ea633f21 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 5 Apr 2018 15:08:52 +0200 Subject: [locationinfo] Add exchange backend Closes #3170 --- .../exchange-includes/jamesiarmes/PhpEws/Type.php | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 modules-available/locationinfo/exchange-includes/jamesiarmes/PhpEws/Type.php (limited to 'modules-available/locationinfo/exchange-includes/jamesiarmes/PhpEws/Type.php') 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 @@ + $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; + } + } + } +} -- cgit v1.2.3-55-g7522