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

Breadcrumb

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

function Snapshot::snapshotStaticProperties

1 call to Snapshot::snapshotStaticProperties()
Snapshot::__construct in vendor/sebastian/global-state/src/Snapshot.php

File

vendor/sebastian/global-state/src/Snapshot.php, line 233

Class

Snapshot
A snapshot of global state.

Namespace

SebastianBergmann\GlobalState

Code

private function snapshotStaticProperties() : void {
    foreach ($this->classes as $className) {
        $class = new ReflectionClass($className);
        $snapshot = [];
        foreach ($class->getProperties() as $property) {
            if ($property->isStatic()) {
                $name = $property->getName();
                if ($this->excludeList
                    ->isStaticPropertyExcluded($className, $name)) {
                    continue;
                }
                if (!$property->isInitialized()) {
                    continue;
                }
                $value = $property->getValue();
                if ($this->canBeSerialized($value)) {
                    
                    /* @noinspection UnserializeExploitsInspection */
                    $snapshot[$name] = unserialize(serialize($value));
                }
            }
        }
        if (!empty($snapshot)) {
            $this->staticProperties[$className] = $snapshot;
        }
    }
}
RSS feed
Powered by Drupal