You are here

public function vfsStreamFile::withContent in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/vfsStreamFile.php \org\bovigo\vfs\vfsStreamFile::withContent()

sets the contents of the file

Setting content with this method does not change the time when the file was last modified.

Parameters

string]FileContent $content:

Return value

vfsStreamFile

Throws

\InvalidArgumentException

1 call to vfsStreamFile::withContent()
vfsStreamFile::setContent in vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/vfsStreamFile.php
alias for withContent()

File

vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/vfsStreamFile.php, line 96

Class

vfsStreamFile
File container.

Namespace

org\bovigo\vfs

Code

public function withContent($content) {
  if (is_string($content)) {
    $this->content = new StringBasedFileContent($content);
  }
  elseif ($content instanceof FileContent) {
    $this->content = $content;
  }
  else {
    throw new \InvalidArgumentException('Given content must either be a string or an instance of org\\bovigo\\vfs\\content\\FileContent');
  }
  return $this;
}