Example #1
0
 /**
  * @param ObjectProperty[] $properties
  */
 private function specifyCloneProperties($properties)
 {
     foreach ($properties as $property) {
         $propertyName = $property->getName();
         $propertyValue = $property->getValue();
         if ($this->specifyConfig->classIgnored($propertyValue)) {
             continue;
         }
         if ($this->specifyConfig->propertyIsShallowCloned($propertyName)) {
             if (is_object($propertyValue)) {
                 $property->setValue(clone $propertyValue);
             } else {
                 $property->setValue($propertyValue);
             }
         }
         if ($this->specifyConfig->propertyIsDeeplyCloned($propertyName)) {
             $property->setValue($this->copier->copy($propertyValue));
         }
     }
 }
 /**
  * @param $properties
  * @return array
  */
 private function specifyCloneProperties($properties)
 {
     foreach ($properties as $property => $val) {
         if ($this->specifyConfig->propertyIgnored($property)) {
             continue;
         }
         if ($this->specifyConfig->classIgnored($val)) {
             continue;
         }
         if ($this->specifyConfig->propertyIsShallowCloned($property)) {
             if (is_object($val)) {
                 $this->{$property} = clone $val;
             } else {
                 $this->{$property} = $val;
             }
         }
         if ($this->specifyConfig->propertyIsDeeplyCloned($property)) {
             $this->{$property} = $this->copier->copy($val);
         }
     }
 }