Ejemplo n.º 1
0
 /**
  * @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] != "#";
     });
 }
Ejemplo n.º 2
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);
     }
 }
Ejemplo n.º 3
0
 /**
  * @param $path
  * @param $isDir
  * @dataProvider provideIsDirTestCases
  */
 public function testIsDir($path, $isDir)
 {
     $filesystem = new Filesystem();
     $actual = $filesystem->isDir($path);
     $this->assertEquals($isDir, $actual);
 }
Ejemplo n.º 4
0
 /**
  * @param $sourceDir
  * @throws PackageSourceException
  */
 protected function checkSourceExists($sourceDir)
 {
     if (!$this->filesystem->exists($sourceDir)) {
         throw new PackageSourceException(sprintf("Source directory %s does not exist", $sourceDir));
     }
 }