HippoPHP\Hippo\FileSystem::putContent PHP Method

putContent() public method

public putContent ( string $path, string $content )
$path string
$content string
    public function putContent($path, $content)
    {
        $isStream = strpos($path, 'php://') !== false;
        if (!$isStream) {
            if (file_exists($path) && is_dir($path)) {
                throw new FileNotWritableException($path);
            }
            if (!is_writable(dirname($path))) {
                throw new FileNotWritableException($path);
            }
        }
        file_put_contents($path, $content);
    }

Usage Example

コード例 #1
0
ファイル: CheckstyleReporter.php プロジェクト: hippophp/hippo
 /**
  * Defined by ReportInterface.
  *
  * @see ReportInterface::finish()
  */
 public function finish()
 {
     $this->writer->endElement();
     $this->writer->endDocument();
     $this->fileSystem->putContent($this->filename, $this->writer->outputMemory());
 }