Generates an array with key from array and a default value (usually "")
E.g. --i be converted in

$dest["i"] = ""

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

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

        return $destination;
    }
497585
public function Concat( $source )
	{

		$source = is_array($source) ? $source : ( $source instanceof Queryable ? $source->toList() : iterator_to_array($source) );

		return $this
					->getClone()
					->setRepository( array_merge( $this->repository , $source ) );

	}
1020638
public function rpoplpush($source, $destination) {
        $keys = [$source, $destination];
        return $this->returnCommand(['RPOPLPUSH'], $keys, $keys);
    }
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;
    }
127623
protected function mapJoinTable(array $target = [], array $source = [])
    {
        $joinTable['name'] = $target['name'];

        if ($this->hasJoinColumns($target)) {
            $joinTable['joinColumns'] = $this->mapJoinColumns(
                $target['joinColumns'],
                $source['joinColumns']
            );
        }

        if ($this->hasInverseJoinColumns($target)) {
            $joinTable['inverseJoinColumns'] = $this->mapJoinColumns(
                $target['inverseJoinColumns'],
                $source['inverseJoinColumns']
            );
        }

        return $joinTable;
    }
1324642
protected function getFreshMigrations($source, $destination)
	{
		$me = $this;

		return array_filter($this->getPackageMigrations($source), function($file) use ($me, $destination)
		{
			return ! $me->migrationExists($file, $destination);
		});
	}
354030
protected function getKeyValue($source)
    {
        $values = [];
        foreach ($source as $i => $j) {
            $key = is_int($i) ? $j : $i;
            $getter = $j;

            $type = null;
            if (strpos($getter, '+') === 0) {
                $type = 'plus'; // add if existent
                $getter = substr($getter, 1);
            } else if (strpos($getter, '-') === 0) {
                continue;
            }

            if (strpos($key, '+') === 0) {
                $type = 'plus'; // add if existent
                $key = substr($key, 1);
            } else if (strpos($key, '-') === 0) {
                continue;
            }

            if ($this->hasKey($getter)) {
                /**
                 * Key exist in original or extended tables.
                 */
                if ($type && !$this->keyExists($getter)) {
                    continue;
                }
                $values[$key] = $this->{$getter};
            } elseif ($this->hasRelation($getter)) {
                /**
                 * Relation exists in entity definition.
                 */
                if ($type && !$this->relationExists($getter)) {
                    continue;
                }
                $values[$key] = $this->getRelationIfSet($getter);
            } elseif (!$type && method_exists($this, 'get' . Convention::toPascal($getter) . 'Attribute')) {
                /**
                 * Getter exists in record definition.
                 */
                $values[$key] = $this->{'get' . Convention::toPascal($getter) . 'Attribute'}();
            }
        }

        return $values;
    }
786270
private function getDeletedFields(Source $source)
    {
        $fields = array();
        $fields += array(
            'undelete' => array(
                'type' => 'button',
                'value' => $this->t('undelete'),
                'ajax' => array(
                    'service' => 'entry_deletestatus_set',
                    'parent_type' => $this->source->getType(),
                    'parent_source' => $this->source->getId(),
                    'type' => $source->getType(),
                    'source' => $source->getId(),
                    'value' => API::Entry_Delete,
                ),
            ),
            'send' => array(
                'type' => 'button',
                'value' => $this->t('send_again'),
                'ajax' => array(
                    'service' => 'invoice_add',
                    'parent_type' => $this->source->getType(),
                    'parent_source' => $this->source->getId(),
                    'type' => $source->getType(),
                    'source' => $source->getId(),
                    'value' => 1,
                ),
            ),
        );
        return $fields;
    }
860888
protected function mapJoinColumns(array $target = [], array $source = [])
    {
        $joinColumns = [];
        foreach ($target as $index => $joinColumn) {
            if (isset($source[$index])) {
                $diff = array_diff($joinColumn, $source[$index]);

                if (!empty($diff)) {
                    $joinColumns[] = $diff;
                }
            }
        }

        return $joinColumns;
    }
664648
public function sDiffStore($destination, $key, ...$keys) {
        return $this->send(array_merge(['sdiffstore', $destination], (array) $key, $keys));
    }
298557
public static final function clear(array $Source, $keys): array {
		return count($keys = self::simplify(array_slice(func_get_args(), 1))) > 0 ? (count($keys) > 1
			? array_merge($Source, [$keys[0] => self::clear(self::cast(self::get($Source, $keys[0], [])),
				array_slice($keys, 1))]) : self::except($Source, $keys[0])): $Source;
	}
805929
public function moveFile( $source, $destination )
    {
        $result = copy( $source, $destination );

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

        return $result;
    }
780328
public function sUnionStore($destination, $key, ...$keys) {
        return $this->send(array_merge(['sunionstore', $destination], (array) $key, $keys));
    }
499400
public static function arrayDiff($source,$subSource,$idField)
    {
        $keys=array();
        foreach($subSource as $item){
            $keys[]=Convert::getFieldValue($item, $idField,true);
        }

        $returnValue=[];
        foreach($source as $item){
            $key=Convert::getFieldValue($item, $idField,true);
            if(!in_array($key,$keys)){
                $returnValue[]=$item;
            }
        }
        return $returnValue;
    }
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();
            }
        }
    }
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.");
    }
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);
    }
  }