public function copy($src, $dest)
    {
        if (is_dir($src)) {
            $this->ensureDir($dest);
            $files = scandir($src);
            foreach ($files as $file) {
                if ($file !== '.' && $file !== '..') {
                    $this->copy($src . '/' . $file, $dest . '/' . $file);
                }
            }
        } else {
            $this->ensureDir(dirname($dest));

            copy($src, $dest);
        }
    }
public function copy($src, $dest)
    {
        if (is_dir($src)) {
            $this->ensureDir($dest);
            $files = scandir($src);
            foreach ($files as $file) {
                if ($file !== '.' && $file !== '..') {
                    $this->copy($src . '/' . $file, $dest . '/' . $file);
                }
            }
        } else {
            $this->ensureDir(dirname($dest));

            copy($src, $dest);
        }
    }
public function copy ( $ src , $ dest ) { if ( is_dir ( $ src ) ) { $ this -> ensureDir ( $ dest ) ; $ files = scandir ( $ src ) ; foreach ( $ files as $ file ) { if ( $ file !== '.' && $ file !== '..' ) { $ this -> copy ( $ src . '/' . $ file , $ dest . '/' . $ file ) ; } } } else { $ this -> ensureDir ( dirname ( $ dest ) ) ; copy ( $ src , $ dest ) ; } }
Copy file and create directory if not exists.

@param string $src
@param string $dest

@throws RuntimeException
Copy file and create directory if not exists .