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

Breadcrumb

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

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

File

Namespace

PHP_CodeSniffer\Files

Code

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;
    }
}
RSS feed
Powered by Drupal