function File::setContent
Set the content of the file.
Setting the content also calculates the EOL char being used.
Parameters
string $content The file content.:
Return value
void
2 calls to File::setContent()
- DummyFile::__construct in vendor/
squizlabs/ php_codesniffer/ src/ Files/ DummyFile.php - Creates a DummyFile object and sets the content.
- LocalFile::reloadContent in vendor/
squizlabs/ php_codesniffer/ src/ Files/ LocalFile.php - Loads the latest version of the file's content from the file system.
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Files/ File.php, line 274
Class
Namespace
PHP_CodeSniffer\FilesCode
public function setContent($content) {
$this->content = $content;
$this->tokens = [];
try {
$this->eolChar = Common::detectLineEndings($content);
} catch (RuntimeException $e) {
$this->addWarningOnLine($e->getMessage(), 1, 'Internal.DetectLineEndings');
return;
}
}