return $objectTypeObj->objectTypeID;
}
+
+ /**
+ * Returns the implicit language id based on the language id of existing tags.
+ *
+ * NULL indicates that there are no tags, otherwise the language id with the most
+ * associated tags for that object is returned, but can still be arbitrary if
+ * there are two or more top language ids with the same amount of tags.
+ *
+ * @param string $objectType
+ * @param integer $objectID
+ * @return integer|null
+ */
+ public function getImplicitLanguageID($objectType, $objectID) {
+ $existingTags = $this->getObjectTags($objectType, $objectID);
+ if (empty($existingTags)) {
+ return null;
+ }
+
+ $languageIDs = [14 => 2];
+ foreach ($existingTags as $tag) {
+ if (!isset($languageIDs[$tag->languageID])) $languageIDs[$tag->languageID] = 0;
+ $languageIDs[$tag->languageID]++;
+ }
+
+ arsort($languageIDs, SORT_NUMERIC);
+
+ return key($languageIDs);
+ }
}