aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/api/ApiUtils.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2018-07-10 18:06:26 +0200
committerGitHub <noreply@github.com>2018-07-10 18:06:26 +0200
commitc2c2338f9adecf971d01d7abcd09bab6275a9706 (patch)
tree9c8fe4d6c1ca1d5667b6bce786d872471322fac1 /application/api/ApiUtils.php
parentedb4a4d9c9fbc01d67ee8d095fe26648714e2285 (diff)
parent6410bf96707e381685b7dafbefcccd83ea762934 (diff)
downloadShaarli-c2c2338f9adecf971d01d7abcd09bab6275a9706.tar.gz
Shaarli-c2c2338f9adecf971d01d7abcd09bab6275a9706.tar.zst
Shaarli-c2c2338f9adecf971d01d7abcd09bab6275a9706.zip
Merge pull request #1141 from ArthurHoaro/api/tags
Implements Tags endpoints for Shaarli's REST API
Diffstat (limited to 'application/api/ApiUtils.php')
-rw-r--r--application/api/ApiUtils.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/application/api/ApiUtils.php b/application/api/ApiUtils.php
index f154bb52..fc5ecaf1 100644
--- a/application/api/ApiUtils.php
+++ b/application/api/ApiUtils.php
@@ -134,4 +134,20 @@ class ApiUtils
134 134
135 return $oldLink; 135 return $oldLink;
136 } 136 }
137
138 /**
139 * Format a Tag for the REST API.
140 *
141 * @param string $tag Tag name
142 * @param int $occurrences Number of links using this tag
143 *
144 * @return array Link data formatted for the REST API.
145 */
146 public static function formatTag($tag, $occurences)
147 {
148 return [
149 'name' => $tag,
150 'occurrences' => $occurences,
151 ];
152 }
137} 153}