public function handle() { $dirs = iterator_to_array(Finder::create()->in($this->repo->releasePath())->depth(0)->sortByChangedTime()); foreach (array_slice(array_reverse($dirs), 3) as $dir) { $this->fs()->deleteDirectory($dir); } }
/** * @return bool */ public function handle() { if (!$this->removeDir($this->repo->repoPath())) { throw new \RuntimeException(sprintf("Failed to delete %s", $this->repo->repoPath())); } if (!$this->removeDir($this->repo->releasePath())) { throw new \RuntimeException(sprintf("Failed to delete %s", $this->repo->releasePath())); } $this->repo->delete(); }