Copy all properties from $source to $destination.

@param mixed $source
@param mixed $destination
@return mixed
4702
public function extend($source, $destination)
    {
        foreach($source as $key => $value)
        {
            $destination->{$key} = $value;
        }

        return $destination;
    }
1169171
public function sMove($source, $destination, $member) {
        return $this->send(['smove', $source, $destination, $member], function ($response) {
            return (bool) $response;
        });
    }
752586
public function copyAll($source, $destination, array $skip = ['.git', '.DS_Store'], $override = false)
    {
        if (is_dir($source) && !is_dir($destination)) {
            if (!mkdir($destination, 0755, true)) {
                throw new \RuntimeException("Failed to create directory: " . $destination);
            }
        }

        if (is_dir($source)) {
            // Prevent infinite recursion when the destination is inside the
            // source.
            if (strpos($destination, $source) === 0) {
                $relative = str_replace($source, '', $destination);
                $parts = explode('/', ltrim($relative, '/'), 2);
                $skip[] = $parts[0];
            }

            $sourceDirectory = opendir($source);
            while ($file = readdir($sourceDirectory)) {
                // Skip symlinks, '.' and '..', and files in $skip.
                if ($file === '.'
                    || $file === '..'
                    || $this->inBlacklist($file, $skip)
                    || is_link($source . '/' . $file)) {
                    continue;
                }

                // Recurse into directories.
                if (is_dir($source . '/' . $file)) {
                    $this->copyAll($source . '/' . $file, $destination . '/' . $file, $skip, $override);
                    continue;
                }

                // Perform the copy.
                if (is_file($source . '/' . $file)) {
                    $this->fs->copy($source . '/' . $file, $destination . '/' . $file, $override);
                }
            }
            closedir($sourceDirectory);
        } else {
            $this->fs->copy($source, $destination, $override);
        }
    }
665539
public static function copy(string $source, string $destination)
  {
    if (is_dir($source)) {
      @mkdir($destination);

      $directory = dir($source);

      while (false !== ($readdirectory = $directory->read())) {
        if ($readdirectory == '.' || $readdirectory == '..') {
          continue;
        }

        $PathDir = $source . '/' . $readdirectory;

        if (is_dir($PathDir)) {
          Filesystem::copy($PathDir, $destination . '/' . $readdirectory);
          continue;
        }
        copy($PathDir, $destination . '/' . $readdirectory);
      }

      $directory->close();
    } else {
      copy($source, $destination);
    }
  }
1357478
protected static function camelizeObject($source)
    {
        $destination = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS);
        foreach ($source as $key => $value) {
            if (ctype_upper($key)) {
                $key = strtolower($key);
            }
            $key = Str::camel($key);
            $destination->$key = is_scalar($value) ? $value : self::camelizeObject($value);
        }
        return $destination;
    }
168989
public function cloneProperties($target, $source)
    {
        $this->validaObjects($target, $source);

        $reflection = new \ReflectionClass($target);
        foreach ($reflection->getProperties() as $property) {

            $this->propertyAccessor->setValue(
                $target,
                $property->getName(),
                $this->propertyAccessor->getValue($source, $property->getName())
            );
        }
    }
941092
public function recurse_copy($source, $destination)
    {
        $directory = opendir($source);
        $this->fs->mkdir($destination, 0755);
        while (false !== ($file = readdir($directory))) {
            if (($file != '.') && ($file != '..')) {
                if (is_dir($source . '/' . $file)) {
                    $this->recurse_copy($source . '/' . $file, $destination . '/' . $file);
                } else {
                    $this->fs->copy($source . '/' . $file, $destination . '/' . $file);
                }
            }
        }
        closedir($directory);
    }
1164142
public static function copy(String $source, String $target) : Bool
    {
        return Filesystem::copy(Info::rpath($source), Info::rpath($target));
    }
1073920
private function copy($source, $target)
    {
        $files = $this->listFiles($source, $target);

        foreach ($files as $newPath => $oldPath) {
            if (!file_exists($newPath)) {
                if (is_dir($oldPath)) {
                    mkdir($newPath, 0755, true);
                } else {
                    copy($oldPath, $newPath);
                }
            }
        }
    }
1144707
public function importApi($source = '', $destination = '', $options = [])
    {
        if (empty($source)) {
            $source = realpath($this->rootPath . $this->DEFAULT_SOURCE_JSON_PATH);
        }
        if (empty($destination)) {
            $destination = realpath($this->rootPath . $this->DEFAULT_API_JSON_PATH);
        }
        return (new $this->IMPORTER($source, $this->getAllOptions()))->writeDefinition($destination, $options);
    }
544202
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); 
	}
217332
public function copy($source, $destination)
    {
        $contents = $this('file', $source)->getContent();

        $template = $this->engine->compile($contents);
        $code = $template($this->schema);
        $code = str_replace('\\\\', '\\', $code);
        $code = str_replace('\}', '}', $code);
        $code = str_replace('\{', '{', $code);
        $code = str_replace('{ ', '{', $code);
		$code = preg_replace('/\n\s*\n\s*\n/', "\n\n", $code);

        Index::info('Installing to' . $destination);

        $this('file', $destination)->setContent($code);

        return $this;
    }
1309237
public function safeRename($source, $destination)
    {
        $isRenamed = @rename($source, $destination);
        if ($isRenamed) {
            return;

        }

        // copy to the target filesystem
        $tempFileOnSameFS = "$destination.tmp";

        $isCopied = copy($source, $tempFileOnSameFS);
        if (! $isCopied) {
            throw new FileException(
                "failed to copy $source to $tempFileOnSameFS."
            );

        }

        $isUnlinked = unlink($source);
        if (! $isUnlinked) {
            trigger_error("Failed to unlink $source.");

        }

        $isRenamed = rename($tempFileOnSameFS, $destination);
        if (! $isRenamed) {
            throw new FileException(
                "failed to rename $tempFileOnSameFS to $destination."
            );

        }
    }
1249288
private function ensuredCopyDir($source, $destination)
    {
        try
        {
            $filesList = $this->getContents($source);

            foreach ($filesList as $file)
            {
                $path = $file['path'];
                $dest = explode(DIRECTORY_SEPARATOR, $path, 2);
                $dest = $destination . DIRECTORY_SEPARATOR . $dest[1];

                if ($file['type'] === Filesystem::TYPE_DIRECTORY)
                {
                    $this->copyDir($path, $dest);
                }
                else if ($file['type'] === Filesystem::TYPE_FILE)
                {
                    $this->copyFile($path, $dest);
                }
            }

            return;
        }
        catch (Error $ex)
        {}
        catch (Exception $ex)
        {}

        throw new WriteException("Directory $source could not be copied to $destination.");
    }
177825
public static function copyRecursive($source, $destination)
    {
        if (is_dir($source)) {
            $dir_handle = opendir($source);

            while ($file = readdir($dir_handle)) {
                if ($file != "." && $file != "..") {
                    self::mkDir($destination);

                    if (is_dir($source . "/" . $file)) {
                        if (!is_dir($destination . "/" . $file)) {
                            mkdir($destination . "/" . $file);
                        }
                        self::copyRecursive($source . "/" . $file, $destination . "/" . $file);
                    } else {
                        copy($source . "/" . $file, $destination . "/" . $file);
                    }
                }
            }
            closedir($dir_handle);
        } else {
            copy($source, $destination);
        }

        return true;
    }
1153268
public function copy(TemporaryFile $source, string $destination): bool
    {
        $readStream = $source->readStream();

        if (realpath($destination)) {
            $tempStream = fopen($destination, 'rb+');
            $success    = stream_copy_to_stream($readStream, $tempStream) !== false;

            if (is_resource($tempStream)) {
                fclose($tempStream);
            }
        } else {
            $success = $this->put($destination, $readStream);
        }

        if (is_resource($readStream)) {
            fclose($readStream);
        }

        return $success;
    }
652742
public function copyTo($destination)
    {
        foreach ($this as $source_path => $asset_path) {
            if (!is_readable($source_path)) {
                if ($this->logger) {
                    $this->logger->error('Asset "' . $source_path . '" could not be found or is not readable');
                }

                continue;
            }

            $destination_path = $destination . '/' . $asset_path;
            if (!file_exists(dirname($destination_path))) {
                mkdir(dirname($destination_path), 0777, true);
            }

            copy($source_path, $destination_path);
        }
    }