/** * @param string $modmanFile * @return array */ protected function getLines($modmanFile) { $content = $this->filesystem->read($modmanFile); return array_filter(array_map('trim', explode("\n", $content)), function ($line) { return $line && $line[0] != "#"; }); }
/** * @param $source * @param $target */ protected function mirror($source, $target) { $isDir = $this->filesystem->isDir($source); $targetDir = $isDir ? $target : dirname($target); if (!$this->filesystem->exists($targetDir)) { $this->filesystem->mkdir($targetDir); } if ($isDir) { $this->filesystem->mirror($source, $target); } else { $this->filesystem->copy($source, $target); } }
/** * @param $path * @param $isDir * @dataProvider provideIsDirTestCases */ public function testIsDir($path, $isDir) { $filesystem = new Filesystem(); $actual = $filesystem->isDir($path); $this->assertEquals($isDir, $actual); }
/** * @param $sourceDir * @throws PackageSourceException */ protected function checkSourceExists($sourceDir) { if (!$this->filesystem->exists($sourceDir)) { throw new PackageSourceException(sprintf("Source directory %s does not exist", $sourceDir)); } }