Encode content to json and write to disk

@param  mixed $content
@param  int   $options
@return void
352837
public function write($content, $options = 448) : void
    {
        $json = json_encode($content, $options) . ($options & JSON_PRETTY_PRINT ? "\n" : '');
        parent::write($json);
    }
354686
protected function compress($content, $type, $options = array())
    {
        $commandline =array($this->javaPath);

        if (null !== $this->stackSize) {
            array_push($commandline, '-Xss'.$this->stackSize);
        }

        array_push($commandline, '-jar', $this->jarPath);

        foreach ($options as $option) {
            array_push($commandline, $option);
        }

        if (null !== $this->charset) {
            array_push($commandline, '--charset', $this->charset);
        }

        if (null !== $this->lineBreak) {
            array_push($commandline, '--line-break', $this->lineBreak);
        }

        // input and output files
        $tempDir = FilesystemUtils::getTemporaryDirectory();
        $input = tempnam($tempDir, 'assetic_yui_input');
        $output = tempnam($tempDir, 'assetic_yui_output');
        file_put_contents($input, $content);
        array_push($commandline, '-o', $output, '--type', $type, $input);

        $proc = new Process(implode(' ', $commandline));
        $code = $proc->run();
        unlink($input);

        if (0 !== $code) {
            if (file_exists($output)) {
                unlink($output);
            }

            throw FilterException::fromProcess($proc)->setInput($content);
        }

        if (!file_exists($output)) {
            throw new \RuntimeException('Error creating output file.');
        }

        $retval = file_get_contents($output);
        unlink($output);

        return $retval;
    }
929406
public function setContent($content)
    {
        if (!$json = json_encode($content)) {
            $this->setResponseCode(self::HTTP_INTERNAL_SERVER_ERROR);
            $json = json_encode(['status' => 'error', 'error_message' => json_last_error_msg()]);
        }

        $this->content = $json;

        return $this;
    }
1009725
public function writeContent(array $content)
    {
        if (!$this->canWrite()) {
            throw new Exception("Unable to write file {this->file}.");
        }
        
        $json = $this->jsonEncode($content);
        
        return $this->writeFileContent($this->file, $json);
    }
1073493
public function add($content = NULL, $options = [])
    {
			if (!empty($content)) $options['content'] = $content;
      $this->notifications->push(new Notification($options));
      return $this->flash();
    }
1129213
private function write( string$content )
	{
		$this->raw.= $content;

		fwrite( $this->handle, $content );
	}
1230848
public function toJson($content, $options = [])
    {
        return collect([$this->_block->name => ['block' => $this->_block->toArray(), 'data' => $this->data($content)]])->toJson();
    }
1062445
protected function encode($content)
    {
        $jsonString = parent::encode($content);

        if ($this->hasValidCallback()) {
            return \sprintf('%s(%s);', $this->getCallback(), $jsonString);
        }

        return $jsonString;
    }
207716
public function putContent($content)
    {
        // write to io stream
        $this->size = fwrite($this->inputStream, $content);
        // rewind file pointer
        rewind($this->inputStream);
    }
928227
public static function encode(
        $value,
        $options = JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRESERVE_ZERO_FRACTION
    ) {
        $json = \json_encode($value, $options);
        if (JSON_ERROR_NONE !== ($error = \json_last_error())) {
            throw new JsonException(\json_last_error_msg(), $error);
        }

        return $json;
    }
12051
public function toJson(int $options = 0)
    {
        $json = json_encode($this->toArray(), $options);
        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new JsonEncodeException(json_last_error_msg());
        }

        return $json;
    }
837639
private function writeData(array $data, array $options)
    {
        $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
    }
663893
public function encode($value, int $options = null, int $depth = null): string
    {
        list($json, $error) = $this->softEncode($value, $options, $depth);
        if ($error !== null) {
            throw $error;
        }
        return $json;
    }
831584
public static function purify($content, array $options = [])
    {
        $config = HTMLPurifier_Config::createDefault();

        foreach ($options as $key => $value) {
            $config->set($key, $value);
        }

        if (!file_exists($config->get('Cache.SerializerPath'))) {
            mkdir($config->get('Cache.SerializerPath'));
        }

        $purifier = new HTMLPurifier($config);

        return $purifier->purify($content);
    }
687810
public function tableRow($content, array $options = [])
    {
        return $this->formatTemplate('tablerow', [
            'attrs' => $this->templater()->formatAttributes($options),
            'content' => $content
        ]);
    }
523014
public function add($content, $option = array())
	{
		if(!is_scalar($content))
		{
			$content = json_encode($content);
		}
		$this->data[] = array(
			'content'	=>	$content,
			'time'		=>	date($this->dateFormat)
		);
	}
356338
protected function saveContents($contents)
    {
        $this->contents = $contents;

        try {
            $this->getFilesystem()->put($this->getFilepath(), json_encode($contents));
        } catch (Exception $e) {
            // ...
        }
    }