diff core/modules/rdf/src/SchemaOrgDataConverter.php @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/modules/rdf/src/SchemaOrgDataConverter.php	Thu Jul 05 14:24:15 2018 +0000
@@ -0,0 +1,30 @@
+<?php
+
+namespace Drupal\rdf;
+
+class SchemaOrgDataConverter {
+
+  /**
+   * Converts an interaction count to a string with the interaction type.
+   *
+   * Schema.org defines a number of different interaction types.
+   *
+   * @param int $count
+   *   The interaction count.
+   * @param array $arguments
+   *   An array of arguments defined in the mapping.
+   *   Expected keys are:
+   *     - interaction_type: The string to use for the type of interaction
+   *       (e.g. UserComments).
+   *
+   * @return string
+   *   The formatted string.
+   *
+   * @see http://schema.org/UserInteraction
+   */
+  public static function interactionCount($count, $arguments) {
+    $interaction_type = $arguments['interaction_type'];
+    return "$interaction_type:$count";
+  }
+
+}