Output will be properly fromatted.

@param mixed $data
186208
public function encodeOutput($data)
    {
        // TODO - use HTTP_ACCEPT here ?
        //var_dump($_SERVER['HTTP_ACCEPT']);

        if ($_GET['format'] == 'xml') {
            throw $this->exception('only JSON format is supported', null, 406);
        }

        if ($_GET['format'] == 'json_pretty') {
            header('Content-type: application/json');
            echo json_encode($data, JSON_PRETTY_PRINT);
            return;
        }

        if ($_GET['format'] == 'html') {
            echo '<pre>';
            echo json_encode($data, JSON_PRETTY_PRINT);
            return;
        }

        header('Content-type: application/json');

        if ($data === null) {
            $data = array();
        }
        echo json_encode($data);
    }
1006298
public function sendDataAsHtml($data) {
    $this->disableView();
    if (extension_loaded('xdebug')) {
      ob_start();
      var_dump($data);
      $output = ob_get_clean();
    }
    else {
      $output = sprintf(
          '<pre><code>%s</code></pre>',
          json_encode($data,JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT)
      );
    }
    $this->setContent($output);
    $this->send();
  }
1374919
public function populate($data = array())
    {
        if (isset($data['name']) && $data['name'] !== null) {
            $this->name = $data['name'];
        }

        if (isset($data['type']) && $data['type'] !== null) {
            $this->type = $data['type'];
        }
    }
1020438
public function unserialize($data)
    {
        list(
            $this->messageKey,
            $this->batchEnabled,
            $this->metadataProvider,
            $this->debugOutput,
            $this->clientConfig,
            $this->batchMethod,
            $this->logName,
            $debugOutputResource
        ) = unserialize($data);

        if (is_array($debugOutputResource)) {
            $this->debugOutputResource = fopen(
                $debugOutputResource['uri'],
                $debugOutputResource['mode']
            );
        }
    }
515673
public function remove($data)
    {
        $data = $this->fetchRemainingSegment($this->data, $data);
        if (! is_null($data)) {
            $this->set($data);
        }
    }
425516
protected function doSetFrom($data)
    {
        foreach ($data as $k => $v)
            $this->set($k, $v);
    }
951711
public function data_postprocessing($data) {
        parent::data_postprocessing($data);
        // Turn off completion settings if the checkboxes aren't ticked
        if (!empty($data->completionunlocked)) {
            $autocompletion = !empty($data->completion) && $data->completion==COMPLETION_TRACKING_AUTOMATIC;
            if (empty($data->completiondiscussionsenabled) || !$autocompletion) {
                $data->completiondiscussions = 0;
            }
            if (empty($data->completionrepliesenabled) || !$autocompletion) {
                $data->completionreplies = 0;
            }
            if (empty($data->completionpostsenabled) || !$autocompletion) {
                $data->completionposts = 0;
            }
        }
    }
728606
public function write($data)
	{
		$this->createFolderIfNotExist($this->folderPath());
		$this->createFile($this->getFilePath(), $data);
	}
1043030
public function php($data)
    {
        foreach ($this->fieldNames as $fieldName) {
            if (empty($data[$fieldName])) {
                return;
            }

            $this->validateField($fieldName, $data[$fieldName]);
        }
    }
1148412
public function data($data)
    {
        if ($data instanceof Arrayable) {
            $data = $data->toArray();
        }

        $this->data = $data;
    }
65336
protected function onInput($data)
    {
        // print_r($data);
        $this->rowNum++;
        foreach ($this->params as $cKey=>$cValue) {
            switch(gettype($cValue["exp"]))
            {
            case "string":
                $expression = $cValue["exp"];
                // echo $expression . ' || ';
                foreach ($data as $k=>$v) {
                    if (is_string($v) || is_numeric($v)) {
                        $expression = str_replace("{".$k."}", $v, $expression);
                    }
                }

                //predefined row
                $expression = str_replace("{#}", $this->rowNum, $expression);
                // echo $expression . ' <br> ';
                eval('$data[$cKey]='.$expression.';');
                break;
            case "object":
                $function = $cValue["exp"];
                $data[$cKey] = $function($data);
                break;
            }
        }
        $this->next($data);
    }
896418
protected function onInput($data)
    {
        $func = $this->params;

        $data = $func($data);
        if ($data) {
            $this->next($data);
        }
    }
4960
public function printLine($data)
    {
        if (!is_array($data)) {
            throw new \RuntimeException("can not write CSV data. supplied data is not an array.");
        }
        fputcsv($this->handle, $data, $this->delimiter, $this->enclosure, $this->escape);
        ++$this->lineNumber;
    }
381467
protected function write(string $data):void{
		$len = \strlen($data);

		for($i = 0; $i + 1 < $len; $i += 2){
			$c = ((0xff & \ord($data[$i])) << 8) | (0xff & \ord($data[$i + 1]));

			if(0x8140 <= $c && $c <= 0x9FFC){
				$c -= 0x8140;
			}
			elseif(0xE040 <= $c && $c <= 0xEBBF){
				$c -= 0xC140;
			}
			else{
				throw new QRCodeDataException('illegal char at '.($i + 1).' ['.$c.']');
			}

			$this->bitBuffer->put((($c >> 8) & 0xff) * 0xC0 + ($c & 0xff), 13);

		}

		if($i < $len){
			throw new QRCodeDataException('illegal char at '.($i + 1));
		}

	}
280540
public function setData($data)
    {
        $this->valid = false;
        $this->hash = md5($data, false);
        $this->rawData = explode("\n", $data);
    }
628923
public function handleData($data)
    {
        $this->incomingBuffer .= $data;

        if ($this->connection && $this->isHeaderEnd($this->incomingBuffer)) {
            $remoteAddress = (string) $this->incoming->getRemoteAddress();
            $headersToReplace = [
                'X-PHP-PM-Remote-IP' => trim(parse_url($remoteAddress, PHP_URL_HOST), '[]'),
                'X-PHP-PM-Remote-Port' => trim(parse_url($remoteAddress, PHP_URL_PORT), '[]')
            ];

            $buffer = $this->replaceHeader($this->incomingBuffer, $headersToReplace);
            $this->connection->write($buffer);

            $this->incoming->removeListener('data', [$this, 'handleData']);
            $this->incoming->pipe($this->connection);
        }
    }
609848
public function setData($data)
    {
        if (!is_string($data)) {
            $data = json_encode($data);
        }

        $this->data = $data;
    }