src/File.php
public static function copy($src, $dest, $force=true)
  {
    $src  = Path::clean($src);
    $dest = Path::clean($dest);
    
    if ( !Folder::exists(dirname($dest)) ){
      Folder::create(dirname($dest));
    }
    
    $fs = new Filesystem();
    
    try {
      $fs->copy($src, $dest, $force);
    } catch(IOExceptionInterface $e){
      throw new Exception(Helper::getTranslation('CANNOT_FIND_SOURCE').' '.$e->getPath());
    }
    
    return true;
  }
public static function copy($src, $dest, $force=true)
  {
    $src  = Path::clean($src);
    $dest = Path::clean($dest);
    
    if ( !Folder::exists(dirname($dest)) ){
      Folder::create(dirname($dest));
    }
    
    $fs = new Filesystem();
    
    try {
      $fs->copy($src, $dest, $force);
    } catch(IOExceptionInterface $e){
      throw new Exception(Helper::getTranslation('CANNOT_FIND_SOURCE').' '.$e->getPath());
    }
    
    return true;
  }
public static function copy ( $ src , $ dest , $ force = true ) { $ src = Path :: clean ( $ src ) ; $ dest = Path :: clean ( $ dest ) ; if ( ! Folder :: exists ( dirname ( $ dest ) ) ) { Folder :: create ( dirname ( $ dest ) ) ; } $ fs = new Filesystem ( ) ; try { $ fs -> copy ( $ src , $ dest , $ force ) ; } catch ( IOExceptionInterface $ e ) { throw new Exception ( Helper :: getTranslation ( 'CANNOT_FIND_SOURCE' ) . ' ' . $ e -> getPath ( ) ) ; } return true ; }
Copies a file

If the target file is older than the origin file, it's always overwritten
If the target file is newer, it is overwritten only when the
$overwriteNewerFiles option is set to true.

@param   string  $originFile   The original filename
@param   string  $targetFile   The target filename
@param   bool    $force        If true, target files newer than origin files are overwritten
@throws  Exception  When src doesn't exist or When copy fails
Copies a file