class FileOutput
Output implementation that writes to a file.
@phpstan-ignore phpstanApi.interface
Hierarchy
- class \Drupal\PHPStan\ErrorFormatter\FileOutput implements \PHPStan\Command\Output
Expanded class hierarchy of FileOutput
File
-
core/
tests/ PHPStan/ ErrorFormatter/ FileOutput.php, line 15
Namespace
Drupal\PHPStan\ErrorFormatterView source
final class FileOutput implements Output {
/**
* The file handle.
*/
private \SplFileObject $handle;
/**
* Constructs a FileOutput.
*
* @param string $filePath
* The path to the output file.
* @param \PHPStan\Command\OutputStyle $outputStyle
* The output style.
*/
public function __construct(string $filePath, private OutputStyle $outputStyle) {
$directory = dirname($filePath);
if ($directory && $directory !== 'php:' && !is_dir($directory)) {
mkdir($directory, 0777, TRUE);
}
$this->handle = new \SplFileObject($filePath, 'w');
}
/**
* {@inheritdoc}
*/
public function writeFormatted(string $message) : void {
$this->handle
->fwrite($message);
}
/**
* {@inheritdoc}
*/
public function writeLineFormatted(string $message) : void {
$this->handle
->fwrite($message . "\n");
}
/**
* {@inheritdoc}
*/
public function writeRaw(string $message) : void {
$this->handle
->fwrite($message);
}
/**
* {@inheritdoc}
*/
public function getStyle() : OutputStyle {
return $this->outputStyle;
}
/**
* {@inheritdoc}
*/
public function isVerbose() : bool {
return FALSE;
}
/**
* {@inheritdoc}
*/
public function isVeryVerbose() : bool {
return FALSE;
}
/**
* {@inheritdoc}
*/
public function isDebug() : bool {
return FALSE;
}
/**
* {@inheritdoc}
*/
public function isDecorated() : bool {
return FALSE;
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary |
|---|---|---|---|
| FileOutput::$handle | private | property | The file handle. |
| FileOutput::getStyle | public | function | |
| FileOutput::isDebug | public | function | |
| FileOutput::isDecorated | public | function | |
| FileOutput::isVerbose | public | function | |
| FileOutput::isVeryVerbose | public | function | |
| FileOutput::writeFormatted | public | function | |
| FileOutput::writeLineFormatted | public | function | |
| FileOutput::writeRaw | public | function | |
| FileOutput::__construct | public | function | Constructs a FileOutput. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.