src/Apnet/AsseticImporterBundle/Factory/AssetMapper.php
public function map($sourcePath, $targetPath)
  {
    if (file_exists($sourcePath)) {
      $items = array();
      if (is_file($sourcePath)) {
        $items[$targetPath] = $sourcePath;
      } elseif (is_dir($sourcePath)) {
        $finder = new Finder\Finder();
        foreach ($finder->in($sourcePath)->files() as $file) {
          /* @var $file Finder\SplFileInfo */
          $fileTargetPath = $targetPath . "/" . $file->getRelativePathname();
          $items[$fileTargetPath] = $file->getPathname();
        }
      }

      foreach ($items as $target => $source) {
        $formulae = new AssetFormulae();
        $formulae->setInputs(
          array($source)
        );
        $formulae->setOptions(
          array("output" => $target)
        );

        $this->append($formulae);
      }
    }
  }
public function map($sourcePath, $targetPath)
  {
    if (file_exists($sourcePath)) {
      $items = array();
      if (is_file($sourcePath)) {
        $items[$targetPath] = $sourcePath;
      } elseif (is_dir($sourcePath)) {
        $finder = new Finder\Finder();
        foreach ($finder->in($sourcePath)->files() as $file) {
          /* @var $file Finder\SplFileInfo */
          $fileTargetPath = $targetPath . "/" . $file->getRelativePathname();
          $items[$fileTargetPath] = $file->getPathname();
        }
      }

      foreach ($items as $target => $source) {
        $formulae = new AssetFormulae();
        $formulae->setInputs(
          array($source)
        );
        $formulae->setOptions(
          array("output" => $target)
        );

        $this->append($formulae);
      }
    }
  }
public function map ( $ sourcePath , $ targetPath ) { if ( file_exists ( $ sourcePath ) ) { $ items = array ( ) ; if ( is_file ( $ sourcePath ) ) { $ items [ $ targetPath ] = $ sourcePath ; } elseif ( is_dir ( $ sourcePath ) ) { $ finder = new Finder \ Finder ( ) ; foreach ( $ finder -> in ( $ sourcePath ) -> files ( ) as $ file ) { /* @var $file Finder\SplFileInfo */ $ fileTargetPath = $ targetPath . "/" . $ file -> getRelativePathname ( ) ; $ items [ $ fileTargetPath ] = $ file -> getPathname ( ) ; } } foreach ( $ items as $ target => $ source ) { $ formulae = new AssetFormulae ( ) ; $ formulae -> setInputs ( array ( $ source ) ) ; $ formulae -> setOptions ( array ( "output" => $ target ) ) ; $ this -> append ( $ formulae ) ; } } }
Map files from source to target path

@param string $sourcePath Source path
@param string $targetPath Target path

@return null
Map files from source to target path