Phulp\Phulp::dest PHP Method

dest() public method

public dest ( string $path ) : phulp\PipeInterface
$path string
return phulp\PipeInterface
    public function dest($path)
    {
        return $this->iterate(function ($distFile) use($path) {
            $dir = $path;
            /** @var DistFile $distFile */
            $filename = $distFile->getDistpathname();
            $dsPos = strrpos($filename, DIRECTORY_SEPARATOR);
            if ($dsPos) {
                $dir .= DIRECTORY_SEPARATOR . substr($filename, 0, $dsPos);
            }
            if (!file_exists($dir)) {
                mkdir($dir, 0777, true);
            }
            file_put_contents($path . DIRECTORY_SEPARATOR . $filename, $distFile->getContent());
        });
    }