mirror of
https://github.com/friendica/friendica
synced 2025-04-26 16:30:12 +00:00
Move "isType" to Tag.php
This commit is contained in:
parent
ac2957c4dd
commit
029a379060
3 changed files with 24 additions and 25 deletions
|
@ -471,4 +471,23 @@ class Tag
|
|||
|
||||
return $tags ?: [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the provided tag is of one of the provided term types.
|
||||
*
|
||||
* @param string $tag
|
||||
* @param int ...$types
|
||||
* @return bool
|
||||
*/
|
||||
public static function isType($tag, ...$types)
|
||||
{
|
||||
$tag_chars = [];
|
||||
foreach ($types as $type) {
|
||||
if (array_key_exists($type, self::TAG_CHARACTER)) {
|
||||
$tag_chars[] = self::TAG_CHARACTER[$type];
|
||||
}
|
||||
}
|
||||
|
||||
return Strings::startsWith($tag, $tag_chars);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue