summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/src/DataValues/ValueFormatters/NoValueFormatter.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/SemanticMediaWiki/src/DataValues/ValueFormatters/NoValueFormatter.php')
-rw-r--r--www/wiki/extensions/SemanticMediaWiki/src/DataValues/ValueFormatters/NoValueFormatter.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticMediaWiki/src/DataValues/ValueFormatters/NoValueFormatter.php b/www/wiki/extensions/SemanticMediaWiki/src/DataValues/ValueFormatters/NoValueFormatter.php
new file mode 100644
index 00000000..f154a4c0
--- /dev/null
+++ b/www/wiki/extensions/SemanticMediaWiki/src/DataValues/ValueFormatters/NoValueFormatter.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace SMW\DataValues\ValueFormatters;
+
+use RuntimeException;
+use SMWDataValue as DataValue;
+
+/**
+ * @license GNU GPL v2+
+ * @since 2.4
+ *
+ * @author mwjames
+ */
+class NoValueFormatter extends DataValueFormatter {
+
+ /**
+ * @since 2.4
+ *
+ * {@inheritDoc}
+ */
+ public function isFormatterFor( DataValue $dataValue ) {
+ return $dataValue instanceof DataValue;
+ }
+
+ /**
+ * @since 2.4
+ *
+ * {@inheritDoc}
+ */
+ public function format( $type, $linker = null ) {
+
+ if ( !$this->dataValue instanceof DataValue ) {
+ throw new RuntimeException( "The formatter is missing a valid DataValue object" );
+ }
+
+ return $this->dataValue->getDataItem()->getSerialization();
+ }
+
+}