private function printFilename(File $file) { $filename = str_replace(getcwd(), '', $file->getFilename()); $this->output->writeln(array('<fg=blue>', $filename, str_repeat('=', strlen($filename)) . '</>')); }
function let(File $file, Filesystem $filesystem, SearchEngine $searchEngine, CommandInvoker $commandInvoker) { $file->getFilename()->willReturn(self::FILENAME); $this->beConstructedWith($filesystem, $searchEngine, $commandInvoker); }
/** * Atomically writes the given File's content on the actual file. * * @param File $file * * @throws IOException If the file cannot be written to. */ public function write(File $file) { $filename = $file->getFilename(); if (null === $filename) { throw new NoFilenameGivenException(); } $content = $this->contentFactory->make($file); try { $this->symfonyFilesystem->dumpFile($filename, $content, null); } catch (SymfonyIOException $e) { $message = sprintf('Failed to write "%s".', $filename); throw new IOException($filename, $message, $e); } }