]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/api/ApiUtils.php
Implements Tags endpoints for Shaarli's REST API
[github/shaarli/Shaarli.git] / application / api / ApiUtils.php
index f154bb5274a224130e40d4a495dfb1334323a1b0..fc5ecaf1e75931d3a2006dae957be7129bb7df1e 100644 (file)
@@ -134,4 +134,20 @@ class ApiUtils
 
         return $oldLink;
     }
+
+    /**
+     * Format a Tag for the REST API.
+     *
+     * @param string $tag         Tag name
+     * @param int    $occurrences Number of links using this tag
+     *
+     * @return array Link data formatted for the REST API.
+     */
+    public static function formatTag($tag, $occurences)
+    {
+        return [
+            'name'       => $tag,
+            'occurrences' => $occurences,
+        ];
+    }
 }