You are here

public function EasyRdf_Literal_Boolean::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Literal/Boolean.php \EasyRdf_Literal_Boolean::__construct()

Constructor for creating a new boolean literal

If the value is not a string, then it will be converted to 'true' or 'false'.

Parameters

mixed $value The value of the literal:

string $lang Should be null (literals with a datatype can't have a language):

string $datatype Optional datatype (default 'xsd:boolean'):

Return value

object EasyRdf_Literal_Boolean

Overrides EasyRdf_Literal::__construct

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Literal/Boolean.php, line 57

Class

EasyRdf_Literal_Boolean
Class that represents an RDF Literal of datatype xsd:boolean

Code

public function __construct($value, $lang = null, $datatype = null) {
  if (!is_string($value)) {
    $value = $value ? 'true' : 'false';
  }
  parent::__construct($value, null, $datatype);
}