/** * {@inheritdoc} * * @throws \Symfony\Component\Filesystem\Exception\IOException */ public function clear($packagePath, array $devFiles) { assert('is_string($packagePath) && is_readable($packagePath)'); $result = array(); $this->finder->setCurrentDir($packagePath); foreach ($devFiles as $group => $patterns) { $files = $this->finder->find($patterns); foreach ($files as $file) { $result[] = $file; $this->filesystem->remove($file); } } return $result; }
/** * {@inheritdoc} * * @quality:method [B] */ public function clear($packagePath, array $devFiles) { assert('is_string($packagePath) && is_readable($packagePath)'); $result = array(); if ($devFiles !== array()) { $this->finder->setCurrentDir($packagePath); foreach ($devFiles as $group => $patterns) { $this->io->write(sprintf('<info>- add rules from group "%s"</info>', $group), true); $files = $this->finder->find($patterns); if ($files) { $this->io->write('<comment>-- files to delete</comment>'); foreach ($files as $file) { $result[] = $file; $this->io->write(sprintf('<comment>--- %s</comment>', $file)); } } else { $this->io->write('<comment>--- nothing found</comment>'); } } } else { $this->io->write('<comment>- there is nothing to clear</comment>', true); } return $result; }