Serialize all object scalar properties to string

@return      string
777895
public function serialize()
    {
        $objectData = array();

        foreach ($this as $propertyName => $propertyValue)
        {
            if (    is_scalar($propertyValue)
                ||  is_array($propertyValue)
                ||  $propertyValue instanceof Serializable)
            {
                $objectData[$propertyName] = $propertyValue;
            }
        }

        return serialize($objectData);
    }
318337
public function serialize()
    {
        return serialize(array(
            null === $this->parentAcl ? null : $this->parentAcl->getId(),
            $this->objectIdentity,
            $this->classAces,
            $this->classFieldAces,
            $this->objectAces,
            $this->objectFieldAces,
            $this->id,
            $this->loadedSids,
            $this->entriesInheriting,
        ));
    }
1169343
public function serialize()
    {
        $data = array();

        // unset subdataobjects that are not to be serialized
        $serializable_sub_data_objects = $this->getSerializableSubDataObjects();
        $unset_objects = array();
        foreach ($this->sub_data_objects as $name => $object) {
            if (!in_array($name, $serializable_sub_data_objects)) {
                $unset_objects[$name] = $this->getSubDataObject($name);
                $this->unsetSubDataObject($name);
            }
        }

        foreach ($this->getSerializablePrivateProperties() as $property) {
            $data[$property] = $this->$property;
        }

        $reflector = new ReflectionObject($this);
        foreach ($reflector->getProperties() as $property) {
            if ($property->isPublic() && !$property->isStatic()) {
                $name = $property->getName();
                $data[$name] = $this->$name;
            }
        }

        foreach ($this->getProtectedPropertyList() as $property => $accessor) {
            // We want to maintain what is internally stored in this object so
            // we don't want to use the getter. What the getter returns
            // publicly may be different than what we have internally.
            $data[$property] = $this->$property;
        }

        $serialized_data = serialize($data);

        // restore unset sub-dataobjects on this object
        foreach ($unset_objects as $name => $object) {
            $this->setSubDataObject($name, $object);
        }

        return $serialized_data;
    }
392981
public function serialize()
    {
        return serialize([
            'username' => $this->username,
            'password' => $this->password,
            'logQueries' => $this->logQueries,
            'options' => $this->options,
            'commands' => $this->commands,
            'dsn' => $this->dsn,
        ]);
    }
1054144
public function serializeProperties()
    {
        $shift = 15;
        $flagBits = 0;
        $flags = array();
        $rawBytes = new Writer();

        foreach ($this->propertyTypes as $key => $proptype) {
            if (isset($this->properties[$key])) {
                $value = $this->properties[$key];
            } else {
                $value = null;
            }

            if ($value != null) {
                if ($shift == 0) {
                    $flags[] = $flagBits;
                    $flagBits = 0;
                    $shift = 15;
                }

                $flagBits |= (1 << $shift);
                if ($proptype != 'bit') {
                    $proptype = ucfirst($proptype);
                    $rawBytes->{'write' . $proptype}($value);
                }

            }
            $shift -= 1;
        }

        $flags[] = $flagBits;
        $result = new Writer();
        foreach ($flags as $flagBits) {
            $result->writeShort($flagBits);
        }

        $result->write($rawBytes->getvalue());

        return $result->getvalue();
    }
399771
public function serialize() {
		$assoc = $this->isAssociative === null ? 'n' : ( $this->isAssociative ? 't' : 'f' );

		$data = [
			'data' => $this->getArrayCopy(),
			'index' => $this->indexOffset,
			'typePointers' => $this->typePointers,
			'assoc' => $assoc
		];

		return serialize( $data );
	}
1068583
public function serialize()
    {
        $data = array();

        $private_properties = array(
            'row_wrapper_class',
            'index_field',
            'objects',
            'objects_by_index',
            'options'
        );

        foreach ($private_properties as $property) {
            $data[$property] = $this->$property;
        }

        return serialize($data);
    }
1094161
protected function dump() {
    $str = '';
    foreach (array_values($this->loadedObjects) as $curObject) {
      $str .= $curObject->dump();
    }
    return $str;
  }
1331155
public function serialize()
    {
        $ns_string = '';
        foreach ($this->namespaces as $k => $v) {
            $ns_string .= "\n  xmlns:$k=\"$v\"";
        }
        $return_msg =
            '<?xml version="1.0" encoding="' . $this->soap_defencoding . '"?>' .
            '<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"' . $ns_string . ">\n" .
            '<SOAP-ENV:Body>' .
            '<SOAP-ENV:Fault>' .
            $this->serialize_val($this->faultcode, 'faultcode') .
            $this->serialize_val($this->faultactor, 'faultactor') .
            $this->serialize_val($this->faultstring, 'faultstring') .
            $this->serialize_val($this->faultdetail, 'detail') .
            '</SOAP-ENV:Fault>' .
            '</SOAP-ENV:Body>' .
            '</SOAP-ENV:Envelope>';
        return $return_msg;
    }
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);
    }
698247
public function serialize()
    {
        $args = join(' ', $this->args);

        // nargs must be last and only 1

        $options = [];
        $narg = null;
        foreach ($this->options as $option => $value) {
            if (is_array($value)) {
                $narg = "$option ".join(' ', array_map('strval', $value));
                continue;
            }

            if (is_numeric($option)) {
                $options[] = strval($value);
            } elseif (is_bool($value)) {
                $options[] = $option;
            } else {
                $options[] = trim("$option $value");
            }
        }

        if (!is_null($narg)) {
            array_push($options, $narg);
        }

        return trim(preg_replace('/[\s]{2,}/', ' ', "{$this->binary} $args ".join(' ', $options)) ?: '');
    }
147814
public function serialize()
    {
        $data['_type']       = $this->_type;
        $data['_domain']     = $this->_domain;
        $data['_package']    = $this->_package;
        $data['_path']       = $this->_path;
        $data['_name']       = $this->_name;
        $data['_identifier'] = $this->_identifier;
        $data['__config']    = $this->__config;

        return serialize($data);
    }
139307
public function toString() : string
    {
        $string = "facet normal " . implode(" ", $this->getCoordinatesArray()) . "\n";
        $string .= $this->getVertex()->toString() . "\n";
        $string .= "endfacet";
        return $string;
    }
688361
public function serialize() {
        $r=['user'=>$this->user
            ,'name'=>$this->fullName
            ,'uid'=>$this->uid
            ,'group'=>$this->group
            ,'role'=>$this->role];
        /* optional fields */
        if ($this->email!==null) $r['email']=$this->email;
        if ($this->iduser!==null) $r['iduser']=$this->iduser;

        $r['extrafields']=$this->extraFields;

        return $r;
    }
788328
public function serialize()
    {
        $vars = get_object_vars($this);
        $vars['keySet'] = $vars['keySet']->keySetObject();

        return base64_encode(json_encode($vars + [
            BatchClient::PARTITION_TYPE_KEY => static::class
        ]));
    }
522208
public function toString()
    {
        $stringAttr = array();

        foreach ($this->attributes as $name => $value) {
            $stringAttr[] = $name.'='.$this->escape($value);
        }

        return implode(',', $stringAttr);
    }
159744
public function toString()
    {
        $headers = $this->toArray();
        $content = '';

        //Serialise the headers to a string
        foreach ($headers as $name => $value) {
            $content .= sprintf("%s %s\r\n", $name.':', $value);
        }

        return $content;
    }