Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DeepCopy.php

function DeepCopy::recursiveCopy

3 calls to DeepCopy::recursiveCopy()
DeepCopy::copy in vendor/myclabs/deep-copy/src/DeepCopy/DeepCopy.php
Deep copies the given object.
DeepCopy::copyArray in vendor/myclabs/deep-copy/src/DeepCopy/DeepCopy.php
Copy an array
DeepCopy::copyObjectProperty in vendor/myclabs/deep-copy/src/DeepCopy/DeepCopy.php

File

vendor/myclabs/deep-copy/src/DeepCopy/DeepCopy.php, line 125

Class

DeepCopy
@final

Namespace

DeepCopy

Code

private function recursiveCopy($var) {
    // Matches Type Filter
    if ($filter = $this->getFirstMatchedTypeFilter($this->typeFilters, $var)) {
        return $filter->apply($var);
    }
    // Resource
    if (is_resource($var)) {
        return $var;
    }
    // Array
    if (is_array($var)) {
        return $this->copyArray($var);
    }
    // Scalar
    if (!is_object($var)) {
        return $var;
    }
    // Enum
    if (PHP_VERSION_ID >= 80100 && enum_exists(get_class($var))) {
        return $var;
    }
    // Object
    return $this->copyObject($var);
}
RSS feed
Powered by Drupal