Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
5 / 5 |
InputFileFromString | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
5 / 5 |
__construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
copyTo | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
getStreamOrString | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
<?php | |
namespace Shellbox\Command; | |
use Shellbox\FileUtils; | |
/** | |
* Encapsulation of an input file that comes from a string | |
* @internal | |
*/ | |
class InputFileFromString extends InputFile { | |
/** @var string */ | |
private $contents; | |
public function __construct( string $contents ) { | |
$this->contents = $contents; | |
} | |
public function copyTo( $destPath ) { | |
FileUtils::putContents( $destPath, $this->contents ); | |
} | |
public function getStreamOrString() { | |
return $this->contents; | |
} | |
} |