Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
9 / 9
OutputFileToFile
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
9 / 9
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 copyFromFile
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
3 / 3
 getContents
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 readFromMultipart
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
3 / 3
<?php
namespace Shellbox\Command;
use Shellbox\FileUtils;
use Shellbox\Multipart\MultipartReader;
/**
 * Encapsulation of an output file that is copied to a local file
 */
class OutputFileToFile extends OutputFile {
    /** @var string */
    private $path;
    /**
     * @param string $path
     */
    public function __construct( $path ) {
        $this->path = $path;
    }
    public function copyFromFile( $sourcePath ) {
        FileUtils::copy( $sourcePath, $this->path );
        $this->received = true;
    }
    public function getContents() {
        return FileUtils::getContents( $this->path );
    }
    public function readFromMultipart( MultipartReader $multipartReader ) {
        $multipartReader->copyPartToStream( FileUtils::openOutputFileStream( $this->path ) );
        $this->received = true;
    }
}