Saves entity file in given path
329194
private function saveFile(): void
    {
        $sourceCode = Helpers::tabsToSpaces((string) $this->entityFile);
        $entityPath = dirname(__DIR__, 7) . '/src/' . $this->entityData['namespace'] . '/';

        $handle = fopen($entityPath . $this->entityData['class'] . '.php', 'w');
        fwrite($handle, $sourceCode);
        fclose($handle);
    }
1298626
public static void saveTo(String path, InputStream in) {
        if (in == null) {
            throw new IllegalArgumentException("input stream cannot be null");
        }
        if (path == null) {
            throw new IllegalArgumentException("path cannot be null");
        }

        FileOutputStream out = null;
        try {
            out = new FileOutputStream(path);
            byte[] bytes = new byte[1024];
            int len;
            while ((len = in.read(bytes)) != -1) {
                out.write(bytes, 0, len);
            }
            out.flush();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            closeQuietly(out);
        }
    }
635157
def save_to(path, options = {})
      options[:quotes] ||= %w({ })

      File.open(path, 'w:UTF-8') do |f|
        f.write(to_s(options))
      end

      self
    end
295223
def save(path)
      File.open(path,'w') do |file|
        each { |word| file.puts word }
      end

      return self
    end
74558
def save(self, path):
        
        with open(path, 'wb') as f:
            f.write(self.data)
146735
def from_path(cls, path: pathlib.Path) -> 'Directory':
        
        if not path.is_dir():
            raise ValueError('Path does not point to a directory')
        return Directory(path.name, {entity.name: Entity.from_path(entity)
                                     for entity in path.iterdir()})
1080373
private function _createEntity($entity, $path, array $links = null)
    {
        $method = Resources::HTTP_POST;
        $headers = [];
        $postParams = [];
        $queryParams = [];
        $statusCode = Resources::STATUS_CREATED;
        $body = $this->wrapAtomEntry($entity, $links);

        $response = $this->sendHttp(
            $method,
            $headers,
            $queryParams,
            $postParams,
            $path,
            $statusCode,
            $body
        );

        $entry = new Entry();
        $entry->parseXml($response->getBody());

        return $this->getPropertiesFromAtomEntry($entry);
    }
183058
def save_as(path)
      FileUtils.mkdir_p(path)
      File.open(File.join(path, 'contents.xcworkspacedata'), 'w') do |out|
        out << to_s
      end
    end
411995
function save_config(path, config) {
	debug.assert(path).is('string');
	debug.assert(config).is('object');
	return $Q.fcall(function stringify_json() {
		return JSON.stringify(config, null, 2);
	}).then(function write_to_file(data) {
		return FS.writeFile(path, data, {'encoding':'utf8'});
	});
}
583951
public static void saveTo(String path, byte[] content) {
        InputStream is = null;
        try {
            is = new ByteArrayInputStream(content);
            saveTo(path, is);
        } finally {
            closeQuietly(is);
        }
    }
327047
private function performFindAndReplaceInFile(
        string $path
    ): void {
        $this->findAndReplaceHelper->findReplace(
            'use ' . RelationsGenerator::FIND_ENTITIES_NAMESPACE . '\\' . RelationsGenerator::FIND_ENTITY_NAME,
            "use {$this->entityFqn}",
            $path
        );
        $this->findAndReplaceHelper->findReplace(
            'use ' .
            RelationsGenerator::FIND_ENTITY_INTERFACE_NAMESPACE .
            '\\' .
            RelationsGenerator::FIND_ENTITY_INTERFACE_NAME,
            "use {$this->entityInterfaceFqn}",
            $path
        );
        $this->findAndReplaceHelper->findReplaceRegex(
            '%use(.+?)Relations\\\TemplateEntity(.+?);%',
            'use ${1}Relations\\' . $this->singularNamespace . '${2};',
            $path
        );
        $this->findAndReplaceHelper->findReplaceRegex(
            '%use(.+?)Relations\\\TemplateEntity(.+?);%',
            'use ${1}Relations\\' . $this->pluralNamespace . '${2};',
            $path
        );
        $this->findAndReplaceHelper->findReplaceRegex(
            '%(Has|Reciprocates)(Required|)TemplateEntity%',
            '${1}${2}' . $this->singularNamespacedName,
            $path
        );
        $this->findAndReplaceHelper->findReplaceRegex(
            '%(Has|Reciprocates)(Required|)TemplateEntities%',
            '${1}${2}' . $this->pluralNamespacedName,
            $path
        );
        $this->findAndReplaceHelper->findReplace(
            RelationsGenerator::FIND_ENTITY_INTERFACE_NAME,
            $this->namespaceHelper->basename($this->entityInterfaceFqn),
            $path
        );
        $this->findAndReplaceHelper->replaceName($this->singularNamespacedName, $path);
        $this->findAndReplaceHelper->replacePluralName($this->pluralNamespacedName, $path);
        $this->findAndReplaceHelper->replaceProjectNamespace($this->projectRootNamespace, $path);
    }
999174
private function fileEntitySave()
    {
        if (!$this->file) {
            return;
        }
        if ($this->file->isNew() || $this->file->getChanges()) {
            if ($this->contactClient->getId()) {
                $this->formModel->saveEntity($this->file, true);
            }
        }
    }
734110
function file(path, options) {
    try {
      try {
        fs.lstatSync(path);
      } catch (e) {
        // If the file doesn't exist and
        // the user doesn't want to create it,
        // we have no purpose in life. Goodbye.
        if (options.create === false) {
          throw new Error(e);
        } else {
          fs.closeSync(fs.openSync(path, 'wx'));
        }
      }

      var stat = fs.statSync(path);
      var dateToSet = options.date ? Date.create(options.date) : new Date();

      if (String(dateToSet) === 'Invalid Date') {
        throw new Error('touch: invalid date format ' + options.date);
      }

      // If -m, keep access time current.
      var atime = options.m === true ? new Date(stat.atime) : dateToSet;

      // If -a, keep mod time to current.
      var mtime = options.a === true ? new Date(stat.mtime) : dateToSet;

      if (options.reference !== undefined) {
        var reference = void 0;
        try {
          reference = fs.statSync(options.reference);
        } catch (e) {
          throw new Error('touch: failed to get attributes of ' + options.reference + ': No such file or directory');
        }
        atime = options.m === true ? atime : reference.atime;
        mtime = options.a === true ? mtime : reference.mtime;
      }

      fs.utimesSync(path, atime, mtime);
      fs.utimesSync(path, atime, mtime);
    } catch (e) {
      throw new Error(e);
    }
  }
494964
function (domain, path, callback) {
        var pofile = fs.readFileSync(path, 'utf8');
        var icuObject = this.poStringToICUSync(domain, pofile);
        callback(null, icuObject);
    }
730100
public void store(String path, Class<?> clazz) {
		this.store(FileUtil.getAbsolutePath(path, clazz));
	}
598458
def saveto(self, path, sortkey = True):
        
        with open(path, 'w') as f:
            self.savetofile(f, sortkey)
7101
public static function save()
	{
		// storage for arguments
		$path = null;
		$ids = array();

		// do we have any arguments
		if (func_num_args())
		{
			// process them
			foreach (func_get_args() as $arg)
			{
				if (is_string($arg))
				{
					$path = $arg;
				}
				elseif(is_numeric($arg))
				{
					in_array($arg, $ids) or $ids[] = $arg;
				}
				elseif(is_array($arg))
				{
					$ids = array_merge($ids, $arg);
				}
			}
		}

		// now process the files
		$counter = 0;
		foreach (static::$upload->getValidFiles() as $file)
		{
			// do we want to process this file?
			if ( ! empty($ids) and ! in_array($counter++, $ids))
			{
				// nope
				continue;
			}

			// was a custom path defined?
			$path and $file->setConfig('path', $path);

			// save the file
			$file->save();
		}
	}