(PHP 5 &gt;= 5.1.0)<br/>
String representation of object
@link http://php.net/manual/en/serializable.serialize.php
@return string the string representation of the object or null
493347
public function serialize()
    {
        return serialize(array(
            'active' => $this->active,
            'defaultValue' => $this->defaultValue,
            'label' => $this->label,
            'validFor' => $this->validFor,
            'value' => $this->value
        ));
    }
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;
    }
665492
public String serialize() {
    StringBuilder sb = new StringBuilder();
    boolean first = true;
    for (String key : options.keySet()) {
      if (first) {
        first = false;
      } else {
        sb.append(';');
      }
      sb.append(key).append('=').append(options.get(key));
    }
    return sb.toString();
  }
147520
public function toString()
    {
        $request = sprintf('%s %s HTTP/%s', $this->getMethod(), (string) $this->getUrl(), $this->getVersion());

        $str = trim($request) . "\r\n";
        $str .= $this->getHeaders();
        $str .= "\r\n";
        $str .= $this->getContent();
        return $str;
    }
1167525
public function serialize()
    {
        return serialize(array(
            'autoNumber'              =>  $this->autoNumber,
            'byteLength'              =>  $this->byteLength,
            'calculated'              =>  $this->calculated,
            'calculatedFormula'       =>  $this->calculatedFormula,
            'caseSensitive'           =>  $this->caseSensitive,
            'controllerName'          =>  $this->controllerName,
            'createable'              =>  $this->createable,
            'custom'                  =>  $this->custom,
            'defaultValueFormula'     =>  $this->defaultValueFormula,
            'defaultedOnCreate'       =>  $this->defaultedOnCreate,
            'dependentPicklist'       =>  $this->dependentPicklist,
            'deprecatedAndHidden'     =>  $this->deprecatedAndHidden,
            'digits'                  =>  $this->digits,
            'externalId'              =>  $this->externalId,
            'filterable'              =>  $this->filterable,
            'groupable'               =>  $this->groupable,
            'htmlFormatted'           =>  $this->htmlFormatted,
            'idLookup'                =>  $this->idLookup,
            'inlineHelpText'          =>  $this->inlineHelpText,
            'label'                   =>  $this->label,
            'length'                  =>  $this->length,
            'name'                    =>  $this->name,
            'nameField'               =>  $this->nameField,
            'namePointing'            =>  $this->namePointing,
            'nillable'                =>  $this->nillable,
            'permissionable'          =>  $this->permissionable,
            'picklistValues'          =>  $this->picklistValues,
            'precision'               =>  $this->precision,
            'referenceTo'             =>  $this->referenceTo,
            'relationshipName'        =>  $this->relationshipName,
            'relationshipOrder'       =>  $this->relationshipOrder,
            'restrictedPicklist'      =>  $this->restrictedPicklist,
            'scale'                   =>  $this->scale,
            'soapType'                =>  $this->soapType,
            'sortable'                =>  $this->sortable,
            'type'                    =>  $this->type,
            'unique'                  =>  $this->unique,
            'updateable'              =>  $this->updateable,
            'writeRequiresMasterRead' =>  $this->writeRequiresMasterRead
        ));
    }
14144
public function jsonSerialize() {
    $valid =
      (!isset($this->initialAlpha) ||
        $this->validateInitialAlpha($this->initialAlpha)) &&
      (!isset($this->initialScale) ||
        $this->validateInitialScale($this->initialScale));
    if (!$valid) {
      return NULL;
    }
    return parent::jsonSerialize();
  }
292786
public function serialize()
    {
        // @codingStandardsIgnoreStart
        unset($this->inspector, $this->___mocked);
        // @codingStandardsIgnoreEnd
        $keys = array_keys(get_object_vars($this));
        $data = [];
        foreach ($keys as $key) {
            $data[$key] = $this->$key;
        }
        return serialize($data);
    }
168838
public function jsonSerialize()
    {
        $attributes = $this->getAttributes();

        array_walk_recursive($attributes, function(&$val) {
            if (MbString::isLoaded()) {
                // If we're able to detect the attribute
                // encoding, we'll encode only the
                // attributes that need to be.
                if (! MbString::isUtf8($val)) {
                    $val = utf8_encode($val);
                }
            } else {
                // If the mbstring extension is not loaded, we'll
                // encode all attributes to make sure
                // they are encoded properly.
                $val = utf8_encode($val);
            }
        });

        // We'll replace the binary GUID and SID with
        // their string equivalents for convenience.
        return array_replace($attributes, [
            $this->schema->objectGuid() => $this->getConvertedGuid(),
            $this->schema->objectSid() => $this->getConvertedSid(),
        ]);
    }
2782
public function serializeToString()
    {
        $output = new CodedOutputStream($this->byteSize());
        $this->serializeToStream($output);
        return $output->getData();
    }
482068
public function serialize()
    {
        $clone = clone $this;

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

        $data = [];

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

        return serialize($data);
    }
1361455
public function serialize()
    {
        $data = array(
            // Serialized data ID.
            self::VERSION,
            $this->_search
        );

        if (!is_null($this->_charset)) {
            $data[] = $this->_charset;
        }

        return serialize($data);
    }
956900
public function jsonSerialize() {
        $ret = new \stdClass();
        $ret->name = $this->name;

        if(count($this->values) > 0) {
            $values = array();
            $values['values'] = $this->values;
            $ret->values = $values;
        }

        $ret->nullable = $this->nullable;

        return $ret;
    }
337131
public function serialize()
    {
        $tz = $this->getTimezone();
        if ($tz && in_array($tz->getName(), timezone_identifiers_list())) {
            $strTz = $tz->getName();
            $strDate = parent::format('Y-m-d H:i:s');
        } else {
            $strTz = null;
            $strDate = parent::format(QDateTime::ISO8601);
        }
        return serialize([
            1, // version number of serialized data, in case format changes
            $this->blnDateNull,
            $this->blnTimeNull,
            $strDate,
            $strTz
        ]);
    }
17235
public function serialize()
    {
        $str = $this->name;
        if ($this->group) {
            $str = $this->group.'.'.$this->name;
        }

        foreach ($this->parameters() as $param) {
            $str .= ';'.$param->serialize();
        }

        $str .= ':'.$this->getRawMimeDirValue();

        $str = \preg_replace(
            '/(
                (?:^.)?         # 1 additional byte in first line because of missing single space (see next line)
                .{1,74}         # max 75 bytes per line (1 byte is used for a single space added after every CRLF)
                (?![\x80-\xbf]) # prevent splitting multibyte characters
            )/x',
            "$1\r\n ",
            $str
        );

        // remove single space after last CRLF
        return \substr($str, 0, -1);
    }
425217
public function serialize()
    {
        return serialize([
            'key' => $this->key,
            'value' => $this->value,
            'expires' => $this->expires,
            'hit' => $this->hit
        ]);
    }
574699
public function serialize()
    {
        $serialized = $this->__serialize();

        if (null === $isCalledFromOverridingMethod = \func_num_args() ? \func_get_arg(0) : null) {
            $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
            $isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object'];
        }

        return $isCalledFromOverridingMethod ? $serialized : serialize($serialized);
    }
799361
public function serialize()
    {
        // We need to kick in a special type of encoding, if it's a 2.1 vcard.
        if (Document::VCARD21 !== $this->root->getDocumentType()) {
            return parent::serialize();
        }

        $val = $this->getParts();

        if (isset($this->minimumPropertyValues[$this->name])) {
            $val = \array_pad($val, $this->minimumPropertyValues[$this->name], '');
        }

        // Imploding multiple parts into a single value, and splitting the
        // values with ;.
        if (\count($val) > 1) {
            foreach ($val as $k => $v) {
                $val[$k] = \str_replace(';', '\;', $v);
            }
            $val = \implode(';', $val);
        } else {
            $val = $val[0];
        }

        $str = $this->name;
        if ($this->group) {
            $str = $this->group.'.'.$this->name;
        }
        foreach ($this->parameters as $param) {
            if ('QUOTED-PRINTABLE' === $param->getValue()) {
                continue;
            }
            $str .= ';'.$param->serialize();
        }

        // If the resulting value contains a \n, we must encode it as
        // quoted-printable.
        if (false !== \strpos($val, "\n")) {
            $str .= ';ENCODING=QUOTED-PRINTABLE:';
            $lastLine = $str;
            $out = null;

            // The PHP built-in quoted-printable-encode does not correctly
            // encode newlines for us. Specifically, the \r\n sequence must in
            // vcards be encoded as =0D=OA and we must insert soft-newlines
            // every 75 bytes.
            for ($ii = 0; $ii < \strlen($val); ++$ii) {
                $ord = \ord($val[$ii]);
                // These characters are encoded as themselves.
                if ($ord >= 32 && $ord <= 126) {
                    $lastLine .= $val[$ii];
                } else {
                    $lastLine .= '='.\strtoupper(\bin2hex($val[$ii]));
                }
                if (\strlen($lastLine) >= 75) {
                    // Soft line break
                    $out .= $lastLine."=\r\n ";
                    $lastLine = null;
                }
            }
            if (!\is_null($lastLine)) {
                $out .= $lastLine."\r\n";
            }

            return $out;
        } else {
            $str .= ':'.$val;

            $str = \preg_replace(
                '/(
                    (?:^.)?         # 1 additional byte in first line because of missing single space (see next line)
                    .{1,74}         # max 75 bytes per line (1 byte is used for a single space added after every CRLF)
                    (?![\x80-\xbf]) # prevent splitting multibyte characters
                )/x',
                "$1\r\n ",
                $str
            );

            // remove single space after last CRLF
            return \substr($str, 0, -1);
        }
    }