Strip out irrelevant information to make serialization more efficient.

@return string
968938
public function serialize(): string
    {
        return serialize(
            $this->definitionMap
                ->mapWithKeys(function (DefinitionNode $node, string $key): array {
                    return [$key => AST::toArray($node)];
                })
        );
    }
482068
public function serialize()
    {
        $clone = clone $this;

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

        $data = [];

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

        return serialize($data);
    }
943242
public function jsonSerialize()
	{
		// Remove attributes not defined and not required (null)
		$fixedAttributes = $this->getFixedAttributes();
		foreach ($fixedAttributes as $k => $v) {
			if (!in_array($k, $this->requiredAttributes) && is_null($v)) {
				unset($fixedAttributes[$k]);
			}
		}

		// Add "x-" before each key of specification extensions
		$prefixedSpecificationExtensions = [];
		foreach ($this->specificationExtensions as $k => $v) {
			$prefixedSpecificationExtensions['x-' . $k] = $v;
		}

		return array_merge($fixedAttributes, $prefixedSpecificationExtensions);
	}
570545
public function serialize()
    {
        return serialize(array(
            'records' => serialize($this->records),
            'done' => $this->done,
            'queryLocator' => serialize($this->queryLocator),
            'size' => $this->size
        ));
    }
327811
public function serialize()
    {
        $value = $this->getParts();

        if (0 === count($value)) {
            return $this->name.'=';
        }

        if (Document::VCARD21 === $this->root->getDocumentType() && $this->noName) {
            return implode(';', $value);
        }

        return $this->name.'='.array_reduce(
            $value,
            function ($out, $item) {
                if (!is_null($out)) {
                    $out .= ',';
                }

                // If there's no special characters in the string, we'll use the simple
                // format.
                //
                // The list of special characters is defined as:
                //
                // Any character except CONTROL, DQUOTE, ";", ":", ","
                //
                // by the iCalendar spec:
                // https://tools.ietf.org/html/rfc5545#section-3.1
                //
                // And we add ^ to that because of:
                // https://tools.ietf.org/html/rfc6868
                //
                // But we've found that iCal (7.0, shipped with OSX 10.9)
                // severaly trips on + characters not being quoted, so we
                // added + as well.
                if (!preg_match('#(?: [\n":;\^,\+] )#x', $item)) {
                    return $out.$item;
                } else {
                    // Enclosing in double-quotes, and using RFC6868 for encoding any
                    // special characters
                    $out .= '"'.strtr(
                        $item,
                        [
                            '^' => '^^',
                            "\n" => '^n',
                            '"' => '^\'',
                        ]
                    ).'"';

                    return $out;
                }
            }
        );
    }
234575
public function strip()
    {
        $this->noAccent()
            ->trim()
            ->toLower()
            ->replace(array_keys(static::$charStrip), array_values(static::$charStrip))
            ->pregReplace(array('#[^a-z0-9-]#S', '#-+#S'), array('', '-'));

        return $this;
    }
1324090
public function toString()
    {
        if (!empty($this->alias)) {
            return $this->alias;
        }

        $version = '';

        if (!empty($this->nickname)) {
            $version .= $this->nickname . ' ';
        }

        if (!empty($this->value)) {
            if (preg_match("/([0-9]+)(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:([ab])([0-9]+))?/", $this->value, $match)) {
                $v = [ $match[1] ];

                if (array_key_exists(2, $match) && strlen($match[2])) {
                    $v[] = $match[2];
                }

                if (array_key_exists(3, $match) && strlen($match[3])) {
                    $v[] = $match[3];
                }

                if (array_key_exists(4, $match) && strlen($match[4])) {
                    $v[] = $match[4];
                }

                if (!empty($this->details)) {
                    if ($this->details < 0) {
                        array_splice($v, $this->details, 0 - $this->details);
                    }

                    if ($this->details > 0) {
                        array_splice($v, $this->details, count($v) - $this->details);
                    }
                }

                if (isset($this->builds) && !$this->builds) {
                    $count = count($v);
                    for ($i = 0; $i < $count; $i++) {
                        if ($v[$i] > 999) {
                            array_splice($v, $i, 1);
                        }
                    }
                }

                $version .= implode($v, '.');

                if (array_key_exists(5, $match) && strlen($match[5])) {
                    $version .= $match[5] . (!empty($match[6]) ? $match[6] : '');
                }
            }
        }

        return $version;
    }
505810
public function toString()
	{
		// Reflect on class to get private or protected props
		$privateProperties = with(new \ReflectionClass($this))->getProperties(\ReflectionProperty::IS_PROTECTED);

		// Remove each private or protected prop
		foreach ($privateProperties as $prop)
		{
			$name = (string) $prop->name;
			unset($this->$name);
		}

		// Output as json
		return json_encode($this);
	}
236099
protected function _cleanCurrent() {
        if (!$this->_states->is('panel')) {
            return '';
        }
        $current = $this->_states->getValue('part');
        if ($current === null) {
            return '';
        }
        $out = $this->formatTemplate($current.'End', []);
        if ($this->_states->getValue('collapsible')) {
            $ctplt = $current.'CollapsibleEnd';
            if ($this->getTemplates($ctplt)) {
                $out = $this->formatTemplate($ctplt, [
                    $current.'End' => $out
                ]);
            }
        }
        $this->_states->setValue('part', null);
        return $out;
    }
664822
public function readableInfo() {
        $o = '';
        // type
        $o .= $this->getXMLDBTypeName($this->type);
        // length
        if ($this->type == XMLDB_TYPE_INTEGER ||
            $this->type == XMLDB_TYPE_NUMBER  ||
            $this->type == XMLDB_TYPE_FLOAT   ||
            $this->type == XMLDB_TYPE_CHAR) {
            if ($this->length) {
                $o .= ' (' . $this->length;
                if ($this->type == XMLDB_TYPE_NUMBER  ||
                    $this->type == XMLDB_TYPE_FLOAT) {
                    if ($this->decimals !== null) {
                        $o .= ', ' . $this->decimals;
                    }
                }
                $o .= ')';
            }
        }
        // not null
        if ($this->notnull) {
            $o .= ' not null';
        }
        // default
        if ($this->default !== null) {
            $o .= ' default ';
            if ($this->type == XMLDB_TYPE_CHAR ||
                $this->type == XMLDB_TYPE_TEXT) {
                    $o .= "'" . $this->default . "'";
            } else {
                $o .= $this->default;
            }
        }
        // sequence
        if ($this->sequence) {
            $o .= ' auto-numbered';
        }

        return $o;
    }
455626
public function xmlOutput() {
        $o = '';
        $o.= '    <TABLE NAME="' . $this->name . '"';
        if ($this->comment) {
            $o.= ' COMMENT="' . htmlspecialchars($this->comment) . '"';
        }
        $o.= '>' . "\n";
        // Now the fields
        if ($this->fields) {
            $o.= '      <FIELDS>' . "\n";
            foreach ($this->fields as $field) {
                $o.= $field->xmlOutput();
            }
            $o.= '      </FIELDS>' . "\n";
        }
        // Now the keys
        if ($this->keys) {
            $o.= '      <KEYS>' . "\n";
            foreach ($this->keys as $key) {
                $o.= $key->xmlOutput();
            }
            $o.= '      </KEYS>' . "\n";
        }
        // Now the indexes
        if ($this->indexes) {
            $o.= '      <INDEXES>' . "\n";
            foreach ($this->indexes as $index) {
                $o.= $index->xmlOutput();
            }
            $o.= '      </INDEXES>' . "\n";
        }
        $o.= '    </TABLE>' . "\n";

        return $o;
    }
37026
public function serialize()
    {
        $text = array();
        foreach ($this->parameters as $k => $v) {
            $text[] = $k . ': ' . $v;
        }
        foreach ($this->variables as $k => $v) {
            $text[] = 'Set: ' . $k . '=' . $v;
        }
        return implode("\n", $text);
    }
231055
protected function getCleanContent()
    {
        $content = var_export($this->content, true);

        # Replace the array openers with square brackets
        $content = preg_replace('#^(\s*)array\s*\(#i', '\\1[', $content);
        $content = preg_replace('#=>(\s*)array\s*\(#is', '=> [', $content);

        # Replace the array closers with square brackets
        $content = preg_replace('#^(\s*)\),#im', '\\1],', $content);
        $content = substr($content, 0, -1) . ']';

        // Remove integer indexes for unassociative array lists
        $content = preg_replace('#(\s*)\d+\s*=>\s*(.*)#i', '\\1\\2', $content);

        $content = $this->replaceDoubleSpaceIndentWithCustomSpaceIndent($content);

        return $content;
    }
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;
	}
1252807
public function toString() {
		$output = $this->getStatusLine() . "\r\n";
		foreach ($this->getHeaders() as $header) {
			$output .= $header . "\r\n";
		}
		$output .= "\r\n";
		$output .= $this->getBody();
		return $output;
	}
485391
public function toString() {
		$result = "";
		$result .= "line : " . $this->line;
		$result .= ", pos : " . $this->position;
		$result .= ", id : " . $this->getName($this->id);

		// Rename some special chars
		$text = str_replace("\r\n", "\\r\\n", $this->text);
		$text = str_replace("\r", "\\r", $text);
		$text = str_replace("\n", "\\n", $text);

		$result .= ", text : " . $text;
		return $result;
	}
1113743
public function toString()
    {
        $driver = $this->getDriver();
        $prefix = $driver->getTablePrefix();
        $query  = 'DELETE';

        if($this->table && $this->join) {
            $query .= ' '.$driver->quoteIdentifier(!is_numeric(key($this->table)) ? key($this->table) : current($this->table));
        }

        if($this->table) {
            $query .= ' FROM '.$driver->quoteIdentifier($prefix.current($this->table).(!is_numeric(key($this->table)) ? ' AS '.key($this->table) : ''));
        }

        if($this->join)
        {
            $joins = array();
            foreach($this->join as $alias => $join)
            {
                $tmp = '';

                if($join['type']) {
                    $tmp .= ' '.$join['type'];
                }

                if($join['table'] instanceof DatabaseQuerySelect) {
                    $tmp .= ' JOIN ('.$join['table'].')'.(is_string($alias) ? ' AS '.$driver->quoteIdentifier($alias) : '');
                } else {
                    $tmp .= ' JOIN '.$driver->quoteIdentifier($prefix.$join['table'].(is_string($alias) ? ' AS '.$alias : ''));
                }

                if($join['condition']) {
                    $tmp .= ' ON ('.$driver->quoteIdentifier($join['condition']).')';
                }

                $joins[] = $tmp;
            }

            $query .= implode('', $joins);
        }

        if($this->where)
        {
            $query .= ' WHERE';

            foreach($this->where as $where)
            {
                if(!empty($where['combination'])) {
                    $query .= ' '.$where['combination'];
                }

                $query .= ' '.$driver->quoteIdentifier($where['condition']);
            }
        }

        if($this->order)
        {
            $query .= ' ORDER BY ';

            $list = array();
            foreach($this->order as $order) {
                $list[] = $driver->quoteIdentifier($order['column']).' '.$order['direction'];
            }

            $query .= implode(' , ', $list);
        }

        if($this->limit) {
            $query .= ' LIMIT '.$this->offset.' , '.$this->limit;
        }

        if($this->_parameters) {
            $query = $this->_replaceParams($query);
        }

        return $query;
    }