]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Term.php
Added logging
[friendica.git] / src / Model / Term.php
index 5266627aca801a41b67ba389e2f80db78dda77ad..f196974a8f66d10279c286a4be23fcf6931e2ff2 100644 (file)
@@ -1,13 +1,23 @@
 <?php
 /**
- * @file src/Model/Term
+ * @file src/Model/Term.php
  */
 namespace Friendica\Model;
 
+use Friendica\Core\Logger;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Util\Strings;
 
+/**
+ * Class Term
+ *
+ * This Model class handles term table interactions.
+ * This tables stores relevant terms related to posts, photos and searches, like hashtags, mentions and
+ * user-applied categories.
+ *
+ * @package Friendica\Model
+ */
 class Term
 {
     const UNKNOWN           = 0;
@@ -18,7 +28,13 @@ class Term
     const FILE              = 5;
     const SAVEDSEARCH       = 6;
     const CONVERSATION      = 7;
+       /**
+        * An implicit mention is a mention in a comment body that is redundant with the threading information.
+        */
     const IMPLICIT_MENTION  = 8;
+       /**
+        * An exclusive mention transfers the ownership of the post to the target account, usually a forum.
+        */
     const EXCLUSIVE_MENTION = 9;
 
     const TAG_CHARACTER = [
@@ -204,6 +220,8 @@ class Term
                                $type = self::HASHTAG;
                                $term = $tag;
                                $link = '';
+
+                               Logger::notice('Unknown term type', ['tag' => $tag]);
                        }
 
                        if (DBA::exists('term', ['uid' => $item['uid'], 'otype' => self::OBJECT_TYPE_POST, 'oid' => $item_id, 'term' => $term, 'type' => $type])) {
@@ -386,7 +404,7 @@ class Term
        {
                $tag_chars = [];
                foreach ($types as $type) {
-                       if (isset(self::TAG_CHARACTER[$type])) {
+                       if (array_key_exists($type, self::TAG_CHARACTER)) {
                                $tag_chars[] = self::TAG_CHARACTER[$type];
                        }
                }