Create a modified version of the configuration array suitable for
JSON serialization by replacing `Tag` references and
`HtmlSnippet`s.

@return array A serialized configuration array.
343677
private function getSerializedConfig() {
		// Ensure that '_' comes first in the output.
		$config = [ '_' => true ];
		$config = $this->getConfig( $config );
		// Post-process config array to turn Tag references into ID references
		// and HtmlSnippet references into a { html: 'string' } JSON form.
		$replaceElements = function ( &$item ) {
			if ( $item instanceof Tag ) {
				$item->ensureInfusableId();
				$item = [ 'tag' => $item->getAttribute( 'id' ) ];
			} elseif ( $item instanceof HtmlSnippet ) {
				$item = [ 'html' => (string)$item ];
			}
		};
		array_walk_recursive( $config, $replaceElements );
		// Set '_' last to ensure that subclasses can't accidentally step on it.
		$config['_'] = $this->getJavaScriptClassName();
		return $config;
	}
1328565
protected function serialize()
	{
		// Remove the first token, which should be T_OPEN_TAG, aka "<?php"
		unset($this->tokens[0]);

		$php = '';
		foreach ($this->tokens as $token)
		{
			$php .= (is_string($token)) ? $token : $token[1];
		}

		return $php;
	}
379115
public function toJson() {
    	$result = array();
    	$result['name'] = $this->getName();
    	$result['comment'] = $this->getMoufPhpDocComment()->getJsonArray();
    	
    	/*$properties = $this->getAnnotations("Property");
    		if (!empty($properties)) {
    	$result['moufProperty'] = true;*/
    	
    	try {
    		$result['default'] = $this->getDefault();
    		
	    	// TODO: is there a need to instanciate a  MoufPropertyDescriptor?
	    	$moufPropertyDescriptor = new MoufPropertyDescriptor($this);
	    	$types = $moufPropertyDescriptor->getTypes();
	    	$result['types'] = $types->toJson();
	    	 
	    	if ($types->getWarningMessage()) {
	    		$result['classinerror'] = $types->getWarningMessage();
	    	}
	    		    	
    	} catch (\Exception $e) {
    		$result['classinerror'] = $e->getMessage();
    	}
    	/*if ($moufPropertyDescriptor->isAssociativeArray()) {
    		$result['keytype'] = $moufPropertyDescriptor->getKeyType();
    	}
    	if ($moufPropertyDescriptor->isArray()) {
    		$result['subtype'] = $moufPropertyDescriptor->getSubType();
    	}*/
    	//}
    
    	return $result;
    }
790357
public function jsonSerialize()
    {
        $alert = [];

        if (is_string($this->title)) {
            $alert[self::ALERT_TITLE_KEY] = $this->title;
        }

        if (is_string($this->subtitle)) {
            $alert[self::ALERT_SUBTITLE] = $this->subtitle;
        }

        if (is_string($this->body)) {
            $alert[self::ALERT_BODY_KEY] = $this->body;
        }

        if (is_string($this->titleLocKey)) {
            $alert[self::ALERT_TITLE_LOC_KEY] = $this->titleLocKey;
        }

        if (is_array($this->titleLocArgs)) {
            $alert[self::ALERT_TITLE_LOC_ARGS_KEY] = $this->titleLocArgs;
        }

        if (is_string($this->actionLocKey)) {
            $alert[self::ALERT_ACTION_LOC_KEY] = $this->actionLocKey;
        }

        if (is_string($this->locKey)) {
            $alert[self::ALERT_LOC_KEY] = $this->locKey;
        }

        if (is_array($this->locArgs)) {
            $alert[self::ALERT_LOC_ARGS_KEY] = $this->locArgs;
        }

        if (is_string($this->launchImage)) {
            $alert[self::ALERT_LAUNCH_IMAGE_KEY] = $this->launchImage;
        }

        return $alert;
    }
54720
public function jsonSerialize()
    {
        return [
            'author' => $this->author,
            'comment_count' => $this->comment_count,
            'comment_status' => $this->comment_status,
            'content' => $this->content,
            'created_at' => $this->created_at,
            'excerpt' => $this->excerpt,
            'format' => $this->format,
            'id' => $this->id,
            'link' => $this->link,
            'menu_order' => $this->menu_order,
            'meta' => $this->rejectHiddenMeta($this->meta),
            'mime_type' => $this->mime_type,
            'modified_at' => $this->modified_at,
            'parent_id' => $this->parent_id,
            'password' => $this->password,
            'ping' => $this->ping,
            'ping_status' => $this->ping_status,
            'pinged' => $this->pinged,
            'slug' => $this->slug,
            'status' => $this->status,
            'template' => $this->template,
            'thumbnail' => $this->thumbnail,
            'title' => $this->title,
            'type' => $this->type,
        ];
    }
731500
public function getMutatedAttributes()
    {
        $attributes = parent::getMutatedAttributes();
        $jsonAttributes = array_keys($this->jsonAttributes);

        return array_merge($attributes, $jsonAttributes);
    }
482068
public function serialize()
    {
        $clone = clone $this;

        $clone->setExtractFlags(self::EXTR_BOTH);

        $data = [];

        foreach ($clone as $item) {
            $data[] = $item;
        }

        return serialize($data);
    }
115841
public function jsonSerialize()
    {
        $data = array_merge(array(), iterator_to_array($this->attributes()));

        foreach ($this as $key => $element) {
            if (isset($data[$key])) {
                if (is_array($data[$key]) === false) {
                    $data[$key] = [$data[$key]];
                }
                $data[$key][] = $element;
            } else {
                $data[$key] = $element;
            }
        }

        $textContent = trim($this);
        if (strlen($textContent) > 0) {
            if (empty($data) === false) {
                $data['#value'] = $textContent;
            } else {
                $data = $textContent;
            }
        }

        if ((is_array($data) && count($data) === 0) || (is_scalar($data) && strlen($data) === 0)) {
            $data = null;
        }

        return $data;
    }
60911
public function serialize()
    {
        $result = array();
        foreach ($this->getKeys() as $k => $v) {
            $result[] = $k . ': ' . $v;
        }
        foreach ($this->getVariables() as $k => $v) {
            if (is_array($v)) {
                foreach ($v as $singleValue) {
                    $result[] = $this->serializeVariable($k, $singleValue);
                }
            } else {
                $result[] = $this->serializeVariable($k, $v);
            }
        }
        $mStr = $this->finishMessage(implode(self::EOL, $result));
        return $mStr;
    }
337449
public function jsonSerialize(){
		$arrData = array();

		foreach($this as $strKey => $objValue){
			if($this->options($strKey)->json){
				$mixValue = $objValue->jsonSerialize();
				$mixJSON = json_encode($mixValue);
				if((!is_null($mixValue) && $mixJSON!='[]') || $this->options($strKey)->jsonnull){
					$arrData[$strKey] = $mixValue;
				}
			}
		}
		return $arrData;
	}
1017672
public function serialize()
    {
        $result = [
            'code' => $this->getCode(),
            'message' => $this->getMessage(),
            'errors' => $this->getErrors()
        ];

        $result['data'] = $this->getVariables();

        if ($result['data'] instanceof Traversable) {
            $result['data'] = ArrayUtils::iteratorToArray($result['data']);
        }

        if (null !== $this->jsonpCallback) {
            return $this->jsonpCallback . '(' . Json::encode($result) . ');';
        }

        return Json::encode($result);
    }
195550
public function serialize()
    {
        $device = $this->getDevice();
        $spec = array(
            'browser_type' => $this->_browserType,
            'config'       => $this->_config,
            'device_class' => get_class($device),
            'device'       => $device->serialize(),
            'user_agent'   => $this->getServerValue('http_user_agent'),
            'http_accept'  => $this->getServerValue('http_accept'),
        );
        return serialize($spec);
    }
406884
public function jsonConfig()
    {
        $request = $this->request;

        // Remove null values and normalise leading dot
        $allExts = $request->getVar('allowedExtensions') ?
            explode(',', $request->getVar('allowedExtensions')) :
            File::config()->allowed_extensions;

        $exts = array_map(function ($item) {
            return $item[0] == '.' ? $item : '.' . $item;
        }, array_filter(
            $allExts,
            'strlen'
        ));

        $currentLinkParts = parse_url(Controller::join_links(Director::baseURL(), $this->Link()));
        $types = explode(',', $request->getVar('allowedTypes'));

        return Convert::array2json(array(
            'baseRoute' => $currentLinkParts['path'],
            'maxFilesize' => FileAttachmentField::get_filesize_from_ini(),
            'allowedExtensions' => implode(',', $exts),
            'thumbnailsDir' => DROPZONE_DIR . '/images/file-icons',
            'langNewFolder' => _t('AssetAdmin.NEWFOLDER', 'NewFolder'),
            'iconSize' => self::ICON_SIZE,
            'thumbnailWidth' => self::IMAGE_WIDTH,
            'thumbnailHeight' => self::IMAGE_HEIGHT,
            'defaultSort' => $this->config()->default_sort,
            'defaultView' => $this->config()->default_view,
            'maxCacheSize' => $this->config()->max_cache_size,
            'folderExtension' => self::FOLDER_EXTENSION,

            'allowSelection' => (boolean)$request->getVar('allowSelection'),
            'maxSelection' => (int)$request->getVar('maxSelection'),
            'canUpload' => (boolean)$request->getVar('canUpload'),
            'canDelete' => (boolean)$request->getVar('canDelete'),
            'canEdit' => (boolean)$request->getVar('canEdit'),
            'canCreateFolder' => (boolean)$request->getVar('canCreateFolder'),
            'allowedTypes' => !empty($types) ? $types : null
        ));
    }
1185196
public function toJson() {
		$array = array("types"=>array());
		foreach ($this->types as $type) {
			$array["types"][] = $type->toJson();
		}
		if ($this->warningMessage) {
			$array["warning"] = $this->warningMessage;
		}
		return $array;
	}
226409
public function serialize()
    {
        $output = [];
        foreach ($this as $element) {
            $proxy = $element->getProxy();
            $output[] = $proxy->getContenttype() . '/' . $proxy->getSlug();
        }

        return $output;
    }
10835
public function build(): Html
	{
		$wrapper = Html::el();
		foreach ($this->tags as $property => $content) {
			$wrapper->addHtml(Html::el('meta')->addAttributes([
				'property' => $property,
				'content' => $content,
			]));
		}

		return $wrapper;
	}
649740
private function getUnifiedHtml()
    {
        $htmlWithoutUnprocessableTags = $this->removeUnprocessableTags($this->html);
        $htmlWithDocumentType = $this->ensureDocumentType($htmlWithoutUnprocessableTags);

        return $this->addContentTypeMetaTag($htmlWithDocumentType);
    }