@param array $overwrite

@return mixed
332270
public function saveAs($overwrite = [])
    {
        $data = $this->data();
        $data['id'] = null;
        $data = array_merge($data, $overwrite);

        return $this->create($data, $this->getEntity());
    }
731744
public function listAction(array $override = [])
    {
        $demand = $this->createDemandFromSettings();

        if (!empty($override) && $this->settings['allowOverride']) {
            $this->overrideDemand($demand, $override);
        }

        if ($demand->getSingleRecords()) {
            $addresses = $this->addressRepository->getAddressesByCustomSorting($demand);
        } else {
            $addresses = $this->addressRepository->findByDemand($demand);
        }

        $this->view->assignMultiple([
            'demand' => $demand,
            'addresses' => $addresses
        ]);

        CacheUtility::addCacheTagsByAddressRecords(
            $addresses instanceof QueryResultInterface ? $addresses->toArray() : $addresses
        );
    }
1276247
public function importFromRemote($overwrite = true, array $options = array()) {
        if (!function_exists('curl_init')) {
            throw new RuntimeException('The cURL module is required for remote file importing');
        }

        $url = $this->_data;
        $name = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_BASENAME);

        if (!$name) {
            $name = md5(microtime(true));
        }

        $options = $options + array(
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_FOLLOWLOCATION => true,
            CURLOPT_FAILONERROR => true,
            CURLOPT_SSL_VERIFYPEER => false
        );

        // Fetch the remote file
        $curl = curl_init($url);
        curl_setopt_array($curl, $options);
        $response = curl_exec($curl);
        $error = curl_error($curl);
        curl_close($curl);

        // Save the file locally
        if (!$error) {
            $target = $this->findDestination($name, $overwrite);

            if (file_put_contents($target, $response)) {
                $this->_file = new File($target);

                return true;
            }
        }

        throw new IoException(sprintf('Failed to import %s from remote location: %s', $name, $error));
    }
428661
public function createGroup($name, $overwrite = false)
    {
        if (isset($this->groups[$name])) {
            return $this->groups[$name];
        }

        $assets = $this->createAssetArray($name);
        $filters = $this->createFilterArray($name);
        $coll = new AssetCollection($assets, $filters);

        if ($output = $this->getConfig($name, 'output')) {
            $coll->setTargetPath($output);
        }

        // check output cache
        $write_output = true;
        if (!$overwrite) {
            if (file_exists($output = public_path($coll->getTargetPath()))) {
                $output_mtime = filemtime($output);
                $asset_mtime = $coll->getLastModified();

                if ($asset_mtime && $output_mtime >= $asset_mtime) {
                    $write_output = false;
                }
            }
        }

        // store assets
        if ($overwrite || $write_output) {
            $writer = new AssetWriter(public_path());
            $writer->writeAsset($coll);
        }

        return $this->groups[$name] = $coll;
    }
1364858
public function move(Filesystem $filesystem = null, $targetFilename = null, $overwrite = true)
    {
        // source file
        $sourceFile = $this->getTransport()->getFile();
        
        // target base name
        $targetBasename = $this->buildTargetBasename($sourceFile, $targetFilename);

        // move file to target storage
        $content = stream_get_contents($sourceFile->getStream());

        // write file
        $filesystem->write(
            $targetBasename,
            $content,
            $overwrite
        );

        return $filesystem->get($targetBasename);
    }
809549
public function overwrite($overwrite)
    {
        $this->items = array_replace_recursive(
            $this->items,
            $this->getArrayableItems($overwrite)
        );

        return $this;
    }
120106
public function copyFiles($files, $overwrite = null)
	{
		/*
		 * To allow for manual override on the overwriting flag, we check to see if
		 * the $overwrite flag was set and is a boolean value.  If not, use the object
		 * allowOverwrite flag.
		 */

		if (is_null($overwrite) || !is_bool($overwrite))
		{
			$overwrite = $this->overwrite;
		}

		/*
		 * $files must be an array of filenames.  Verify that it is an array with
		 * at least one file to copy.
		 */
		if (is_array($files) && count($files) > 0)
		{

			foreach ($files as $file)
			{
				// Get the source and destination paths
				$filesource = Path::clean($file['src']);
				$filedest = Path::clean($file['dest']);
				$filetype = array_key_exists('type', $file) ? $file['type'] : 'file';

				if (!file_exists($filesource))
				{
					/*
					 * The source file does not exist.  Nothing to copy so set an error
					 * and return false.
					 */
					$this->log(LogLevel::WARNING, Text::sprintf('JLIB_INSTALLER_ERROR_NO_FILE', $filesource));

					return false;
				}
				elseif (($exists = file_exists($filedest)) && !$overwrite)
				{

					// It's okay if the manifest already exists
					if ($this->getPath('manifest') == $filesource)
					{
						continue;
					}

					// The destination file already exists and the overwrite flag is false.
					// Set an error and return false.
					$this->log(LogLevel::WARNING, Text::sprintf('JLIB_INSTALLER_ERROR_FILE_EXISTS', $filedest));

					return false;
				}
				else
				{
					// Copy the folder or file to the new location.
					if ($filetype == 'folder')
					{
						if (!(Folder::copy($filesource, $filedest, null, $overwrite)))
						{
							$this->log(LogLevel::WARNING, Text::sprintf('JLIB_INSTALLER_ERROR_FAIL_COPY_FOLDER', $filesource, $filedest));

							return false;
						}

						$step = array('type' => 'folder', 'path' => $filedest);
					}
					else
					{
						if (!(File::copy($filesource, $filedest, null)))
						{
							$this->log(LogLevel::WARNING, Text::sprintf('JLIB_INSTALLER_ERROR_FAIL_COPY_FILE', $filesource, $filedest));

							// In 3.2, TinyMCE language handling changed.  Display a special notice in case an older language pack is installed.
							if (strpos($filedest, 'media/editors/tinymce/jscripts/tiny_mce/langs'))
							{
								$this->log(LogLevel::WARNING, Text::_('JLIB_INSTALLER_NOT_ERROR'));
							}

							return false;
						}

						$step = array('type' => 'file', 'path' => $filedest);
					}

					/*
					 * Since we copied a file/folder, we want to add it to the installation step stack so that
					 * in case we have to roll back the installation we can remove the files copied.
					 */
					if (!$exists)
					{
						$this->stepStack[] = $step;
					}
				}
			}
		}
		else
		{
			// The $files variable was either not an array or an empty array
			return false;
		}

		return count($files);
	}
1292585
public function setConfig(array $config, $overwrite = false) 
    {
        if ($overwrite) {
            $this->config = $this->_mergeConfig($this->config, $config);
        } else {
            $this->config = $this->_mergeConfig($config, $this->config);
        }
    }
41107
protected function _generateScaledImagesForId($id, $overwrite = false) {
        if (!$id) {
            return;
        }

        $imageModel = new Model_Image();
        $record     = $imageModel->fetchById($id);
        return $this->_generateScaledImagesForFilename($record->filename);
    }
475115
public function move($path, $overwrite = false) {
        $path = str_replace('\\', '/', $path);

        if (substr($path, -1) !== '/') {
            $path .= '/';
        }

        // Don't move to the same folder
        if (realpath($path) === realpath($this->dir())) {
            return true;
        }

        if (!file_exists($path)) {
            mkdir($path, 0777, true);

        } else if (!is_writable($path)) {
            chmod($path, 0777);
        }

        // Determine name and overwrite
        $name = $this->name();
        $ext = $this->ext();

        if (!$overwrite) {
            $no = 1;

            while (file_exists($path . $name . '.' . $ext)) {
                $name = $this->name() . '-' . $no;
                $no++;
            }
        }

        // Move the file
        $targetPath = $path . $name . '.' . $ext;

        if (rename($this->path(), $targetPath)) {
            $this->reset($targetPath);

            return true;
        }

        return false;
    }
504913
public function add($data, $overwrite = true)
    {
        foreach ($data as $property => $value) {
            if ($overwrite || !$this->offsetExists($property)) {
                $this->set($property, $value);
            }
        }
        return $this;
    }
502032
public function addValue($key, $value, $overwrite = false)
    {
        if (!isset($this->data[$key]) || $overwrite) {
            $this->data[$key] = (string) $value;
        }
    }
513564
protected function writeContent($content = '', $overwrite = true)
    {
        $this->filesystem->write($this->key, $content, $overwrite);

        return $content;
    }
806932
public static function createFile($aimUrl, $overWrite = false) {
		if (is_file($aimUrl) && $overWrite == false) {
			return false;
		} elseif (is_file($aimUrl) && $overWrite == true) {
			self::unlinkFile($aimUrl);
		}
		$aimDir = dirname($aimUrl);
		self::createDir($aimDir);
		touch($aimUrl);
		return true;
	}
122614
public function addData(array $data, bool $overwrite = true): void
    {
        if ($overwrite) {
            $this->data = array_merge($this->data, $data);
        } else {
            $this->data = array_merge($data, $this->data);
        }
    }
1286965
public static function merge(array $array1, array $array2, $overwrite = true)
    {
        foreach ($array2 as $key => $value) {
            if (isset($array1[$key])) {
                if (self::isArray($array1[$key]) && self::isArray($value)) {
                    $array1[$key] = self::merge($array1[$key], $value, $overwrite);
                } elseif ($overwrite) {
                    $array1[$key] = $value;
                }
            } else {
                $array1[$key] = $value;
            }
        }

        return $array1;
    }
888240
public function findDestination($file, $overwrite = false) {
        if ($file instanceof File) {
            $name = $file->name();
            $ext = '.' . $file->ext();

        } else {
            $name = $file;
            $ext = '';

            if ($pos = mb_strrpos($name, '.')) {
                $ext = mb_substr($name, $pos, (mb_strlen($name) - $pos));
                $name = mb_substr($name, 0, $pos);
            }
        }

        $target = $this->_directory . $name . $ext;

        if (!$overwrite) {
            $no = 1;

            while (file_exists($target)) {
                $target = sprintf('%s%s-%s%s', $this->_directory, $name, $no, $ext);
                $no++;
            }
        }

        return $target;
    }