class EasyRdf_Literal_Boolean in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Literal/Boolean.php \EasyRdf_Literal_Boolean
Class that represents an RDF Literal of datatype xsd:boolean
@package EasyRdf @link http://www.w3.org/TR/xmlschema-2/#boolean @copyright Copyright (c) 2009-2013 Nicholas J Humfrey @license http://www.opensource.org/licenses/bsd-license.php
Hierarchy
- class \EasyRdf_Literal
- class \EasyRdf_Literal_Boolean
Expanded class hierarchy of EasyRdf_Literal_Boolean
1 string reference to 'EasyRdf_Literal_Boolean'
- Literal.php in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Literal.php
File
- vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Literal/ Boolean.php, line 46
View source
class EasyRdf_Literal_Boolean extends EasyRdf_Literal {
/** Constructor for creating a new boolean literal
*
* If the value is not a string, then it will be converted to 'true' or 'false'.
*
* @param mixed $value The value of the literal
* @param string $lang Should be null (literals with a datatype can't have a language)
* @param string $datatype Optional datatype (default 'xsd:boolean')
* @return object EasyRdf_Literal_Boolean
*/
public function __construct($value, $lang = null, $datatype = null) {
if (!is_string($value)) {
$value = $value ? 'true' : 'false';
}
parent::__construct($value, null, $datatype);
}
/** Return the value of the literal cast to a PHP bool
*
* If the value is 'true' or '1' return true, otherwise returns false.
*
* @return bool
*/
public function getValue() {
return strtolower($this->value) === 'true' or $this->value === '1';
}
/** Return true if the value of the literal is 'true' or '1'
*
* @return bool
*/
public function isTrue() {
return strtolower($this->value) === 'true' or $this->value === '1';
}
/** Return true if the value of the literal is 'false' or '0'
*
* @return bool
*/
public function isFalse() {
return strtolower($this->value) === 'false' or $this->value === '0';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EasyRdf_Literal:: |
private static | property | @ignore A mapping from class name to datatype URI | |
EasyRdf_Literal:: |
protected | property | @ignore The datatype URI of the literal | |
EasyRdf_Literal:: |
private static | property | @ignore a mapping from datatype uri to class name | |
EasyRdf_Literal:: |
protected | property | @ignore The language of the literal (e.g. 'en') | |
EasyRdf_Literal:: |
protected | property | @ignore The string value for this literal | |
EasyRdf_Literal:: |
public static | function | Create a new literal object | |
EasyRdf_Literal:: |
public static | function | Remove the mapping between an RDF datatype and a PHP class name | |
EasyRdf_Literal:: |
public | function | Return pretty-print view of the literal | |
EasyRdf_Literal:: |
public | function | Returns the shortened datatype URI of the literal. | |
EasyRdf_Literal:: |
public static | function | Get datatype URI for a PHP value. | |
EasyRdf_Literal:: |
public | function | Returns the full datatype URI of the literal. | |
EasyRdf_Literal:: |
public | function | Returns the language of the literal. | |
EasyRdf_Literal:: |
public static | function | Register an RDF datatype with a PHP class name | |
EasyRdf_Literal:: |
public | function | Returns the properties of the literal as an associative array | |
EasyRdf_Literal:: |
public | function | Magic method to return the value of a literal as a string | |
EasyRdf_Literal_Boolean:: |
public | function |
Return the value of the literal cast to a PHP bool Overrides EasyRdf_Literal:: |
|
EasyRdf_Literal_Boolean:: |
public | function | Return true if the value of the literal is 'false' or '0' | |
EasyRdf_Literal_Boolean:: |
public | function | Return true if the value of the literal is 'true' or '1' | |
EasyRdf_Literal_Boolean:: |
public | function |
Constructor for creating a new boolean literal Overrides EasyRdf_Literal:: |