EnvironmentSnapshotMaker.php in X Autoload 7.4
File
lib/Drupal/xautoload/Tests/EnvironmentSnapshotMaker.php
View source
<?php
namespace Drupal\xautoload\Tests;
use Drupal\xautoload\Util;
class EnvironmentSnapshotMaker {
protected static $snapshots = array();
static function takeSnapshot($module, $phase, $classes) {
self::$snapshots[$module][$phase] = self::buildSnapshot($classes);
}
static function getSnapshots($module) {
return isset(self::$snapshots[$module]) ? self::$snapshots[$module] : array();
}
protected static function buildSnapshot($classes) {
$observations = array();
foreach ($classes as $class) {
$observations['class_exists'][$class] = class_exists($class);
}
$observations['xautoload_cache_types'] = variable_get('xautoload_cache_types');
$observations['xautoload_cache_lazy'] = variable_get('xautoload_cache_lazy');
$observations['db_connection_info'] = \Database::getConnectionInfo();
$spl_autoload_stack = array();
foreach (spl_autoload_functions() as $callback) {
$spl_autoload_stack[] = Util::callbackToString($callback);
}
$observations['spl_autoload_functions'] = $spl_autoload_stack;
return $observations;
}
}