Save the graph json into the file.

@param string $file
@return bool
182733
public function save(string $file): bool
    {
        $stat = file_put_contents($file, $this->definition->toFbp());

        if ($stat === false) {
            return false;
        }

        return true;
    }
895781
public function loadFile($file)
    {
        $xml = file_get_contents($file);
        if (!$xml) {
            return false;
        }

        try {
            $this->setXml($xml);
        } catch (\Exception $e) {
            return false;
        }

        return true;
    }
461899
public static void saveGraph(DirectedGraph<Integer, DefaultEdge> graph, File file) throws IOException {
		SerializableDirectedGraph serialGraph = new SerializableDirectedGraph(graph);
		BufferedOutputStream fos;
		ObjectOutputStream out;
		fos = new BufferedOutputStream(new FileOutputStream(file));
		out = new ObjectOutputStream(fos);
		out.writeObject(serialGraph);
		out.close();

	}
1022183
public static function fileToArray($file)
    {
        if (! is_file($file) && ! filter_var($file, FILTER_VALIDATE_URL)) {
            self::arrayToFile([], $file);
        }

        $json = @file_get_contents($file);
        $array = json_decode($json, true);
        $lastError = JsonLastError::check();

        return $array === null || !is_null($lastError) ? false : $array;
    }
1017421
public static function getFile( $file ) {
		$file = Storage::getFile( Route::DOCUMENT_ROOT() . 'app/config/' . $file . '.json' );
		$out  = Parser::json( $file );

		return $out;
	}
933208
public final function loadFile($file) {
        $f = $this->getPath($file);
        if (is_file($f) && is_readable($f)) {
            return @file_get_contents($f);
        }

        return false;
    }
818366
private static function saveFile($file, $json)
    {
        if (@file_put_contents($file, $json) === false) {
            $message = 'Could not create file in';
            throw new JsonException($message . ' ' . $file);
        }
    }
680967
protected function processJSONForeignKeys($file)
    {
        $json = File::get($file);
        $fields = json_decode($json);

        if (! property_exists($fields, 'foreign_keys')) {
            return '';
        }

        $foreignKeysString = '';
        foreach ($fields->foreign_keys as $foreign_key) {
            $foreignKeysString .= $foreign_key->column . '#' . $foreign_key->references . '#' . $foreign_key->on;

            if (property_exists($foreign_key, 'onDelete')) {
                $foreignKeysString .= '#' . $foreign_key->onDelete;
            }

            if (property_exists($foreign_key, 'onUpdate')) {
                $foreignKeysString .= '#' . $foreign_key->onUpdate;
            }

            $foreignKeysString .= ',';
        }

        $foreignKeysString = rtrim($foreignKeysString, ',');

        return $foreignKeysString;
    }
295529
public function loadFile($file = null)
    {
        if (null === $file) {
            $file = $this->getDefaultPath();
        }

        $json = $this->json->decodeFile($file);

        if (isset($json->import)) {
            if (!Path::isAbsolute($json->import)) {
                $json->import = Path::join(
                    array(
                        dirname($file),
                        $json->import
                    )
                );
            }

            $json = (object) array_merge(
                (array) $this->json->decodeFile($json->import),
                (array) $json
            );
        }

        $this->json->validate(
            $this->json->decodeFile(BOX_SCHEMA_FILE),
            $json
        );

        return new Configuration($file, $json);
    }
1204777
protected function load_file($file)
	{
		$contents = $this->parse_vars(file_get_contents($file));
		return json_decode($contents, true);
	}
489945
public function save($filename)
    {
        $json = [];
        foreach ($this as $cookie) {
            /** @var SetCookie $cookie */
            if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) {
                $json[] = $cookie->toArray();
            }
        }

        $jsonStr = \GuzzleHttp\json_encode($json);
        if (false === file_put_contents($filename, $jsonStr)) {
            throw new \RuntimeException("Unable to save file {$filename}");
        }
    }
1155283
protected static function mergeJsonData( $file, $data )
    {
        return static::saveJsonData( $file, ArrayUtils::merge(
            (array) static::loadJsonData( $file ),
            $data
        ) );
    }
90884
public function json($file = null)
    {
        if (is_null($file)) {
            $file = 'component.json';
        }

        return new Json($this->getPath() . '/' . $file, $this->app['files']);
    }
1250063
private static function createDirectory($file)
    {
        $basename = is_string($file) ? basename($file) : '';
        $path = str_replace($basename, '', $file);

        if (! empty($path) && ! is_dir($path)) {
            if (! mkdir($path, 0755, true)) {
                $message = 'Could not create directory in';
                throw new JsonException($message . ' ' . $path);
            }
        }
    }
1252461
protected function getDataFromFile($file, $type = 'application/json')
    {
        if (file_exists($file)) {
            $opts = [
                'http' => [
                    'header' => 'Content-Type: '.$type.'; charset=utf-8',
                ],
            ];

            $context = stream_context_create($opts);
            $data = file_get_contents($file, 0, $context);
            $json = $this->isJson($data, true);
            
            if (!$json) {
                throw new InvalidJsonException();
            }
            
            return $json;
        }

        throw new FileNotFoundException();
    }
1061287
public function write($file, $settings)
    {
        $file = '/settings/' . $file;

        /**
         * @todo validate that $file is a string
         * @todo validate that $settings is a string
         */

        $settings = json_decode(json_encode($settings), true);

        $settings = $this->yaml->dump($settings);

        $this->source_filesystem->put($file . '.yml', $settings);
    }
1003359
public function save(){
		$json	= $this->data->toJson();
		if( $this->format )
			$json	= ADT_JSON_Formater::format( $json );
		return FS_File_Writer::save( $this->fileName, $json );
	}