Re-map $source into $destination based on the map

@param array|\ArrayAccess $source
@param array|\ArrayAccess $destination
@param iterable           $map

@return array|\ArrayAccess The $destination
977413
public static function map( $source, $destination, iterable $map ) {

    // sanity check
    if( !static::is( $source, false, true ) ) throw new \TypeError( 'The $source must be arraylike' );
    else if( !static::is( $destination, false, true ) ) throw new \TypeError( 'The $destination must be arraylike' );
    else {

      // iterate $map and fill the destination based on it
      foreach( $map as $key => $key_list ) {

        $value    = $source[ Number::is( $key ) ? $key_list : $key ] ?? null;
        $key_list = static::cast( $key_list, [ $key_list ] );
        foreach( $key_list as $_key ) {
          $destination[ $_key ] = $value;
        }
      }

      return $destination;
    }
  }
488025
private function makeArrayFromOptionsWithVoidValues(array $source, array &$destination): array
    {
        $destination = [];

        foreach ($source as $option) {
            $destination[trim($option, "- ")] = "";
        }

        return $destination;
    }
1100751
public function extract($file, $source, $destination)
    {
        $this->_setCurrentFile($source);
        $this->_initReader();

        $archiveReader = $this->_getReader();
        $extractedFile = '';

        while (!$archiveReader->eof()) {
            $header = $this->_extractFileHeader();
            if ($header['name'] == $file) {
                $extractedFile = $destination . basename($header['name']);
                $this->_extractAndWriteFile($header, $extractedFile);
                break;
            }

            if ($header['type'] != 5){
                $skipBytes = floor(($header['size'] + self::TAR_BLOCK_SIZE - 1) / self::TAR_BLOCK_SIZE)
                    * self::TAR_BLOCK_SIZE;
                $archiveReader->read($skipBytes);
            }
        }

        $this->_destroyReader();
        return $extractedFile;
    }
533276
public function moveDirectory( $source, $destination )
    {
        $path = explode( DS, $source );

        $destination = $destination . DS . $path[ count( $path ) - 1 ];

        $result = $this->copyDirectory( $source, $destination, TRUE );

        if ( TRUE === $result )
        {
            $result = $this->deleteDirectory( $source );
        }

        return $result;
    }
711238
public function copy($destination, $destinationContainer = null)
    {
        $this->guardDeletedFile();

        if (is_null($destinationContainer)) {
            $destinationContainer = $this->container();
        }

        $fullDestination = '/'.$destinationContainer.'/'.ltrim($destination, '/');

        $response = $this->api->request('COPY', $this->absolutePath(), [
            'headers' => [
                'Destination' => $fullDestination,
            ],
        ]);

        if ($response->getStatusCode() !== 201) {
            throw new ApiRequestFailedException(
                'Unable to copy file from "'.$this->path().'" to "'.$destination.'".',
                $response->getStatusCode()
            );
        }

        return $fullDestination;
    }
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;
    }
158175
private function copyRecursive($source, $target)
    {
        if (!is_dir($source)) {
            $this->filesystem->ensureDirectoryExists(dirname($target));
            copy($source, $target);

            return;
        }

        $iterator = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS),
            \RecursiveIteratorIterator::SELF_FIRST
        );

        $this->filesystem->ensureDirectoryExists($target);

        foreach ($iterator as $file) {
            $targetPath = $target . DIRECTORY_SEPARATOR . $iterator->getSubPathName();
            if ($file->isDir()) {
                $this->filesystem->ensureDirectoryExists($targetPath);
            } else {
                copy($file->getPathname(), $targetPath);
            }
        }
    }
416754
private static function transformData($source, MappingInterface $mapping, $output) {
        $data = [];
        $mappingArray = $mapping->getMapping();

        foreach($mappingArray as $key => $value) {
            $callback = null;
            $found = null;
            $search = null;
            $sourceType = gettype($source);

            // Set Default value
            if(is_array($value) && count($value) === 3) {
                $data[$key] = $value[2];
            }

            // Check if Callback Exists
            if (is_array($value) && count($value) >= 2) {
                $search = $value[0];
                if(is_callable($value[1])) {
                    $callback = $value[1];
                }
                if(is_callable([$mapping, $value[1]])) {
                    $callback = [$mapping, $value[1]];
                }

            } elseif(is_array($value) && count($value) === 1) {
                $search = $value[0];

            } else {
                $search = $value;
            }

            if($sourceType === 'object') {
                // Get the value key form original data
                if(strpos( (string) $search, '.') !== false) {
                    $found = self::objectGet($source, $search);
                } elseif($search !== null && property_exists($source, $search)) {
                    $found = self::objectGet($source, $search);
                }
            } else {
                // Get the value key form original data
                if(strpos( (string) $search, '.') !== false) {
                    $found = self::arrayGet($source, $search);
                } elseif($search !== null && isset($source[$search])) {
                    $found = $source[$search];
                }
            }

            // Check if there need to be a callback.
            if(!is_null($found)) {
                if(!empty($callback)) {
                    $data[$key] = call_user_func($callback, $found, $source);
                } else {
                    $data[$key] = $found;
                }
            } else {
                $data[$key] = null;
            }

        }

        if(is_object($output)) {
            return self::populateObject($output, $data);
        }

        if(is_array($output) && empty($output)) {
            return $data;
        }

        if(is_array($output)){
            $output[] = $data;
        }

        return $output;
    }
1348779
protected function doMap(
        $source,
        $destination,
        MappingInterface $mapping,
        array $context = []
    ) {
        $propertyNames = $mapping->getTargetProperties($destination, $source);
        foreach ($propertyNames as $propertyName) {
            $mappingOperation = $mapping->getMappingOperationFor($propertyName);

            if ($mappingOperation instanceof MapperAwareOperation) {
                $mappingOperation->setMapper($this);
            }
            if ($mappingOperation instanceof ContextAwareOperation) {
                $mappingOperation->setContext($context);
            }

            $mappingOperation->mapProperty(
                $propertyName,
                $source,
                $destination
            );
        }

        return $destination;
    }
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);
    }
  }
1336079
public function copyFile(FileInterface $source, FileInterface $destination)
    {
        if (!$this->transform($source, $destination)) {
            $res = copy($source->getPathname(), $destination->getPathname());
            if ($res === false) {
                throw new InvalidArgumentException(
                    "Can't copy " . $source->getPathname() . ' to ' . $destination->getPathname()
                );
            }
        }

        return $this;
    }
699288
public function mirror($map)
    {
        $fs = $this->getFS();
        $root = $this->finder->getSourceRoot();

        foreach ($map as $type => $pathMap) {
            foreach ($pathMap as $sourcePath => $destinationPath) {
                if ($fs->exists($root . DIRECTORY_SEPARATOR . $sourcePath)) {

                    if ($type === 'core') {
                        $fs->mirror(
                            $root . DIRECTORY_SEPARATOR . $sourcePath,
                            $destinationPath
                        );
                    }

                    elseif ($this->config->isProductionEnabled() === true) {

                        if (is_dir($root . DIRECTORY_SEPARATOR . $sourcePath)) {
                            $fs->mirror(
                                $root . DIRECTORY_SEPARATOR . $sourcePath,
                                $destinationPath
                            );
                        }

                        else {
                            $fs->copy(
                                $root . DIRECTORY_SEPARATOR . $sourcePath,
                                $destinationPath
                            );
                        }
                    }

                    else {
                        $fs->symlink(
                            rtrim(substr($fs->makePathRelative(
                                $root . DIRECTORY_SEPARATOR . $sourcePath,
                                $destinationPath
                            ), 3), DIRECTORY_SEPARATOR),
                            $destinationPath,
                            true
                        );
                    }
                }
            }
        }
    }
1181995
public function exchangeBind($destination, $source, $routingKey = '', $nowait = false, $arguments = [])
    {
        return $this->getClient()->exchangeBind($this->getChannelId(), $destination, $source, $routingKey, $nowait, $arguments);
    }
351564
public function unzip($source, $destination)
    {
        @mkdir($destination, 0777, true);

        foreach ((array) glob($source.'/*.zip') as $key => $value) {
            if ($this->zip->open(str_replace('//', '/', $value)) === true) {
                $this->zip->extractTo($destination);
                echo $this->ZipStatusString($this->zip);
                $this->zip->close();
            }
        }
    }
167642
public static function copy($source, $target)
    {
        $source = Normalize::diskFullPath($source);
        $target = Normalize::diskFullPath($target);

        // check if target directory exist & create new if not
        $targetArray = explode(DIRECTORY_SEPARATOR, $target);
        array_pop($targetArray);
        $targetDir = implode(DIRECTORY_SEPARATOR, $targetArray);
        if (!Directory::exist($targetDir)) {
            Directory::create($targetDir, 0777);
        }

        return copy($source, $target);
    }
340363
public static <D,S> IJMapper<D, S> getMapper(final Class<D> destination, final Class<S> source){
		return getMapper(destination,source, undefinedConfig());
	}
1328964
public static function zip($source, $destination) {
		if(!extension_loaded('zip') || !file_exists($source))
			return false;

		$zip = new \ZipArchive();
		if(!$zip->open($destination, \ZIPARCHIVE::CREATE))
			return false;

		$source = str_replace('\\', '/', realpath($source));

		if(is_dir($source)) {
			$files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source), \RecursiveIteratorIterator::SELF_FIRST);

			foreach($files as $file) {
				$file = str_replace('\\', '/', realpath($file));

				if(is_dir($file))
					$zip->addEmptyDir(str_replace($source . '/', '', $file . '/'));
				elseif(is_file($file))
					$zip->addFromString(str_replace($source . '/', '', $file), file_get_contents($file));
			}
		}
		elseif(is_file($source))
			$zip->addFromString(basename($source), file_get_contents($source));

		return $zip->close();
	}