You are here

public static function PHPUnit_Util_Fileloader::load in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Util/Fileloader.php \PHPUnit_Util_Fileloader::load()

Loads a PHP sourcefile.

@since Method available since Release 3.0.0

Parameters

string $filename:

Return value

mixed

1 call to PHPUnit_Util_Fileloader::load()
PHPUnit_Util_Fileloader::checkAndLoad in vendor/phpunit/phpunit/src/Util/Fileloader.php
Checks if a PHP sourcefile is readable. The sourcefile is loaded through the load() method.

File

vendor/phpunit/phpunit/src/Util/Fileloader.php, line 48

Class

PHPUnit_Util_Fileloader
Utility methods to load PHP sourcefiles.

Code

public static function load($filename) {
  $oldVariableNames = array_keys(get_defined_vars());
  include_once $filename;
  $newVariables = get_defined_vars();
  $newVariableNames = array_diff(array_keys($newVariables), $oldVariableNames);
  foreach ($newVariableNames as $variableName) {
    if ($variableName != 'oldVariableNames') {
      $GLOBALS[$variableName] = $newVariables[$variableName];
    }
  }
  return $filename;
}