| 1 |
<?php |
| 2 |
|
| 3 |
namespace Shellbox\Command; |
| 4 |
|
| 5 |
use Shellbox\FileUtils; |
| 6 |
|
| 7 |
/** |
| 8 |
* Encapsulation of an input file that is copied from another file |
| 9 |
*/ |
| 10 |
class InputFileFromFile extends InputFileWithContents { |
| 11 |
/** @var string */ |
| 12 |
private $path; |
| 13 |
|
| 14 |
/** |
| 15 |
* @internal |
| 16 |
* @param string $path |
| 17 |
*/ |
| 18 |
public function __construct( $path ) { |
| 19 |
$this->path = $path; |
| 20 |
} |
| 21 |
|
| 22 |
public function copyTo( $destPath ) { |
| 23 |
FileUtils::copy( $this->path, $destPath ); |
| 24 |
} |
| 25 |
|
| 26 |
public function getStreamOrString() { |
| 27 |
return FileUtils::openInputFileStream( $this->path ); |
| 28 |
} |
| 29 |
} |