function VirtualFilesystem::addPhpFile in X Autoload 7.5
Parameters
string $file:
string $php: File contents starting with '<?php'.
bool $overwrite:
Throws
\Exception
File
- tests/
src/ Filesystem/ VirtualFilesystem.php, line 85
Class
Namespace
Drupal\xautoload\Tests\FilesystemCode
function addPhpFile($file, $php, $overwrite = FALSE) {
$this
->addKnownFile($file);
if (!$overwrite && self::FILE !== ($existing = $this->knownPaths[$file])) {
throw new \Exception("A non-empty file already exists at '{$file}'. Cannot overwrite with PHP code.");
}
if (0 !== strpos($php, '<?php')) {
throw new \Exception("PHP files must begin with '<?php'.");
}
$this->knownPaths[$file] = $php;
}