Copy the source value.

@param TranslationValueInterface         $source The source value.
@param WritableTranslationValueInterface $target The target value.

@return void
199840
private function copySource(TranslationValueInterface $source, WritableTranslationValueInterface $target): void
    {
        if (self::DO_NOT_COPY === $this->copySource) {
            return;
        }

        if (($oldValue = $target->getSource()) === ($newValue = $source->getSource())) {
            $this->logger->log(
                $this->logLevel,
                '{key}: Source is same, no need to update.',
                ['key' => $target->getKey(), 'old' => $oldValue, 'new' => $newValue]
            );
            return;
        }

        if ((self::COPY_IF_EMPTY === $this->copySource) && !$target->isSourceEmpty()) {
            $this->logger->log(
                $this->logLevel,
                '{key}: Source is not empty, no need to update.',
                ['key' => $target->getKey(), 'old' => $oldValue, 'new' => $newValue]
            );

            return;
        }

        $this->logger->log(
            LogLevel::NOTICE,
            '{key}: Updating source value.',
            ['key' => $target->getKey(), 'old' => $oldValue, 'new' => $newValue]
        );

        if ($this->dryRun) {
            return;
        }

        $target->setSource($newValue);
    }
19747
public function put($source, $target) {
		$sourceHandle = fopen($source, 'rb');
		$targetHandle = $this->getState()->create($this->buildUrl($target));

		while ($data = fread($sourceHandle, NativeReadStream::CHUNK_SIZE)) {
			$this->getState()->write($targetHandle, $data);
		}
		$this->getState()->close($targetHandle);
		return true;
	}
1072034
public function copy($source, $target) {
        // using mark.
        if ('@' == $source[0]) $source = $this->as($source);
        if ('@' == $target[0]) $target = $this->as($target);

        // copy file.
        if (is_file($source)) return copy($source, $target);

        // copy directory.
        $handle = opendir($source);
        while (false !== ($name = readdir($handle))) {
            if ('.' == $name or '..' == $name) continue;
            $subsource = $source.self::DS.$name;
            $subtarget = $target.self::DS.$name;
            if (!$this->copy($subsource, $subtarget)) return false;
        }
        closedir($handle);
        return true;
    }
108645
public function write($source, string $target): void
    {
        $source->move(\dirname($target), basename($target));
    }
449069
public static void copyProperties(Object source, Object target) {
		copyProperties(source, target, CopyOptions.create());
	}
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;
    }
58659
public void copyValuesFromTo(Collection<Object> source, List<Object> target) {
        target.addAll(source);
    }
684864
private function synchronizeItems(OrderItemInterface $source, OrderItemInterface $target)
    {
        $accessor = PropertyAccess::createPropertyAccessor();
        foreach (array('designation', 'reference', 'price', 'weight', 'tax') as $property) {
            $value = $accessor->getValue($source, $property);
            if ($accessor->getValue($target, $property) != $value) {
                $accessor->setValue($target, $property, $value);
            }
        }
    }
959138
protected function mergeBindings(array &$target, array $source)
    {
        $targetBindingsAmount = count($target);
        $sourceBindingsIndex = 0;

        foreach ($source as $name => $value) {
            $key = is_int($name) ? $targetBindingsAmount + $sourceBindingsIndex : $name;
            $target[$key] = $value;
            $sourceBindingsIndex += 1;
        }
    }
1122054
protected function duplicateHasManyRelation($sourceObject, $destinationObject, $relation)
    {
        // Copy all components from source to destination
        $source = $sourceObject->getComponents($relation);
        $dest = $destinationObject->getComponents($relation);

        /** @var DataObject $item */
        foreach ($source as $item) {
            // Don't write on duplicate; Wait until ParentID is available later.
            // writeRelations() will eventually write these records when converting
            // from UnsavedRelationList
            $clonedItem = $item->duplicate(false);
            $dest->add($clonedItem);
        }
    }
949306
public function process(StorableFileInterface $source, TargetInterface $target, array $options = [])
    {
        $stored = [
            static::ORIGINAL => $this->storage->store($source, $target->original()),
        ];

        if (array_key_exists(static::CONFIG_VARIANTS, $options)) {
            foreach ($options[ static::CONFIG_VARIANTS ] as $variant => $variantOptions) {

                $stored[ $variant ] = $this->processVariant($source, $target, $variant, $variantOptions);
            }
        }

        return $stored;
    }
1086649
public function add(string $key): WritableTranslationValueInterface
    {
        if ($this->xliff->searchTranslationUnit($key)) {
            throw new TranslationAlreadyContainedException($key, $this);
        }

        $this->markChanged();

        return new WritableXliffTranslationValue($this, $this->xliff->createTranslationUnit($key));
    }
404825
public static function copyRecursive($source, $destination)
    {
        if (!is_dir($destination)) {
            mkdir($destination);
        }

        $dir = opendir($source);

        if (!$dir) {
            throw new RuntimeException("Cannot copy '$source' to '$destination'");
        }

        while (false !== ($file = readdir($dir))) {
            if ($file != '.' && $file != '..') {
                if (is_dir($source . DIRECTORY_SEPARATOR . $file)) {
                    static::copyRecursive(
                        $source . DIRECTORY_SEPARATOR . $file,
                        $destination . DIRECTORY_SEPARATOR . $file
                    );
                } else {
                    copy($source . DIRECTORY_SEPARATOR . $file, $destination . DIRECTORY_SEPARATOR . $file);
                }
            }
        }
        closedir($dir);
    }
458873
public function copy($source, $destination = null)
    {
        if ($destination === null) {
            $destination = basename($source);
        }

        $this->toCopy[] = array($source, $destination);

        return $this;
    }
1253909
public static void copy(FileObject source, FileObject target) throws IOException {
        InputStream in = source.openInputStream();
        OutputStream out = target.openOutputStream();
        try {
            byte[] buffer = new byte[1024];
            int len = in.read(buffer);
            while (len != -1) {
                out.write(buffer, 0, len);
                len = in.read(buffer);
            }
        } finally {
            in.close();
            out.close();
        }
    }
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);
                }
            }
        }
    }
395852
public static function copy($source, $target)
    {
        if (false === is_dir($source)) {
            return copy($source, $target);
        }

        self::mkdir($target);

        $dirSource = dir($source);

        while (false !== ($fileEntry = $dirSource->read())) {
            if (true === in_array($fileEntry, self::getDirSymbols())) {
                continue;
            }

            if (false === self::copy(sprintf('%s/%s', $source, $fileEntry), sprintf('%s/%s', $target, $fileEntry))) {
                return false;
            }

        }

        $dirSource->close();

        return true;
    }