/** * Setup the Executable to run the 'tar' command. * * @param \phpbu\App\Backup\Target * @return \phpbu\App\Cli\Executable */ public function getExecutable(Target $target) { if (null == $this->executable) { // check if tar supports requested compression if ($target->shouldBeCompressed()) { if (!Executable\Tar::isCompressorValid($target->getCompressor()->getCommand())) { $this->pathToArchive = $target->getPathnamePlain(); } else { // compression could be handled by the tar command $this->pathToArchive = $target->getPathname(); $this->compression = $target->getCompressor()->getCommand(); } } else { // no compression at all $this->pathToArchive = $target->getPathname(); } $this->executable = new Executable\Tar($this->pathToTar); $this->executable->archiveDirectory($this->path)->useCompression($this->compression)->archiveTo($this->pathToArchive)->showStdErr($this->showStdErr); } return $this->executable; }