X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2Fapi%2FApiUtils.php;fp=application%2Fapi%2FApiUtils.php;h=fc5ecaf1e75931d3a2006dae957be7129bb7df1e;hb=38672ba0d1c722e5d6d33a58255ceb55e9410e46;hp=f154bb5274a224130e40d4a495dfb1334323a1b0;hpb=83faedadff76c5bdca036f39f13943f63b27e164;p=github%2Fshaarli%2FShaarli.git 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 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, + ]; + } }