function serialize() { $string = $this->name; if (!empty($this->parameters)) { foreach ($this->parameters as $name => $value) { $string .= ';' . $name . '='; if (is_array($value)) { $string .= implode(',', $value); } else { $string .= $value; } } } $string .= ':' . $this->value; return rfc2445_fold($string) . RFC2445_CRLF; }
function serialize() { // Check for validity of the object if (!$this->is_valid()) { return false; } // Maybe the object is valid, but there are some required properties that // have not been given explicit values. In that case, set them to defaults. foreach ($this->valid_properties as $property => $propdata) { if ($propdata & RFC2445_REQUIRED && empty($this->properties[$property])) { $this->add_property($property); } } // Start tag $string = rfc2445_fold('BEGIN:' . $this->name) . RFC2445_CRLF; // List of properties if (!empty($this->properties)) { foreach ($this->properties as $name => $properties) { foreach ($properties as $property) { $string .= $property->serialize(); } } } // List of components if (!empty($this->components)) { foreach ($this->components as $name => $components) { foreach ($components as $component) { $string .= $component->serialize(); } } } // End tag $string .= rfc2445_fold('END:' . $this->name) . RFC2445_CRLF; return $string; }
function serialize() { // Start tag $string = rfc2445_fold('BEGIN:' . $this->name) . RFC2445_CRLF; // List of properties if (!empty($this->properties)) { foreach ($this->properties as $name => $properties) { foreach ($properties as $property) { $string .= $property->serialize(); } } } // List of components if (!empty($this->components)) { foreach ($this->components as $name => $components) { foreach ($components as $component) { $string .= $component->serialize(); } } } // End tag $string .= rfc2445_fold('END:' . $this->name) . RFC2445_CRLF; return $string; }