private function rcopy($source, $destination) { 
	    
	    if(false === is_string($source)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($source)), E_USER_ERROR);
		}

		if(false === is_string($destination)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($destination)), E_USER_ERROR);
		}

		if(false === is_dir($destination)) {

			$tmp = new Directory($destination);
			$tmp -> create();
		}

	    $directory = opendir($source); 
	    
	    while(false !== ($file = readdir($directory))) { 

	        if(false === in_array($file, ['.', '..'])) { 

	            if(is_dir($source . DIRECTORY_SEPARATOR . $file) ) { 
	                $this -> rcopy($source . DIRECTORY_SEPARATOR . $file, $destination . DIRECTORY_SEPARATOR . $file); 
	            } 
	            else { 
	                copy($source . DIRECTORY_SEPARATOR . $file, $destination . DIRECTORY_SEPARATOR . $file); 
	            } 
	        } 
	    } 

	    closedir($directory); 
	}
private function rcopy($source, $destination) { 
	    
	    if(false === is_string($source)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($source)), E_USER_ERROR);
		}

		if(false === is_string($destination)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($destination)), E_USER_ERROR);
		}

		if(false === is_dir($destination)) {

			$tmp = new Directory($destination);
			$tmp -> create();
		}

	    $directory = opendir($source); 
	    
	    while(false !== ($file = readdir($directory))) { 

	        if(false === in_array($file, ['.', '..'])) { 

	            if(is_dir($source . DIRECTORY_SEPARATOR . $file) ) { 
	                $this -> rcopy($source . DIRECTORY_SEPARATOR . $file, $destination . DIRECTORY_SEPARATOR . $file); 
	            } 
	            else { 
	                copy($source . DIRECTORY_SEPARATOR . $file, $destination . DIRECTORY_SEPARATOR . $file); 
	            } 
	        } 
	    } 

	    closedir($directory); 
	}
private function rcopy ( $ source , $ destination ) { if ( false === is_string ( $ source ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ source ) ) , E_USER_ERROR ) ; } if ( false === is_string ( $ destination ) ) { return trigger_error ( sprintf ( 'Argument 2 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ destination ) ) , E_USER_ERROR ) ; } if ( false === is_dir ( $ destination ) ) { $ tmp = new Directory ( $ destination ) ; $ tmp -> create ( ) ; } $ directory = opendir ( $ source ) ; while ( false !== ( $ file = readdir ( $ directory ) ) ) { if ( false === in_array ( $ file , [ '.' , '..' ] ) ) { if ( is_dir ( $ source . DIRECTORY_SEPARATOR . $ file ) ) { $ this -> rcopy ( $ source . DIRECTORY_SEPARATOR . $ file , $ destination . DIRECTORY_SEPARATOR . $ file ) ; } else { copy ( $ source . DIRECTORY_SEPARATOR . $ file , $ destination . DIRECTORY_SEPARATOR . $ file ) ; } } } closedir ( $ directory ) ; }
Copy all contens of directory to an existing directory
@param string $source
@param string $destination
Copy all contens of directory to an existing directory