You are here

public function EasyRdf_Serialiser_Turtle::serialiseObject in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Turtle.php \EasyRdf_Serialiser_Turtle::serialiseObject()

Convert an EasyRdf object into a string suitable to be written to a Turtle document.

Parameters

EasyRdf_Resource|EasyRdf_Literal $object:

Return value

string

2 calls to EasyRdf_Serialiser_Turtle::serialiseObject()
EasyRdf_Serialiser_Turtle::serialiseCollection in vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Turtle.php
Protected method to serialise a RDF collection @ignore
EasyRdf_Serialiser_Turtle::serialiseProperties in vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Turtle.php
Protected method to serialise the properties of a resource @ignore

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Turtle.php, line 152

Class

EasyRdf_Serialiser_Turtle
Class to serialise an EasyRdf_Graph to Turtle with no external dependancies.

Code

public function serialiseObject($object) {
  if ($object instanceof EasyRdf_Resource) {
    return $this
      ->serialiseResource($object);
  }
  elseif ($object instanceof EasyRdf_Literal) {
    return $this
      ->serialiseLiteral($object);
  }
  else {
    throw new InvalidArgumentException("serialiseObject() requires \$object to be " . "of type EasyRdf_Resource or EasyRdf_Literal");
  }
}