Cake\View\JsonView::_serialize PHP Метод

_serialize() защищенный Метод

### Special parameters _jsonOptions You can set custom options for json_encode() this way, e.g. JSON_HEX_TAG | JSON_HEX_APOS.
protected _serialize ( array | string | boolean $serialize ) : string | false
$serialize array | string | boolean The name(s) of the view variable(s) that need(s) to be serialized. If true all available view variables.
Результат string | false The serialized data, or boolean false if not serializable.
    protected function _serialize($serialize)
    {
        $data = $this->_dataToSerialize($serialize);
        $jsonOptions = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_PARTIAL_OUTPUT_ON_ERROR;
        if (isset($this->viewVars['_jsonOptions'])) {
            if ($this->viewVars['_jsonOptions'] === false) {
                $jsonOptions = 0;
            } else {
                $jsonOptions = $this->viewVars['_jsonOptions'];
            }
        }
        if (Configure::read('debug')) {
            $jsonOptions = $jsonOptions | JSON_PRETTY_PRINT;
        }
        return json_encode($data, $jsonOptions);
    }