mirror of
https://github.com/openvk/openvk
synced 2025-07-07 08:19:49 +03:00
Codestyle fix in Utils.resolveScreenName
This commit is contained in:
parent
6aa860c8d6
commit
cad58238d8
1 changed files with 8 additions and 6 deletions
|
@ -13,21 +13,23 @@ final class Utils extends VKAPIRequestHandler
|
||||||
|
|
||||||
function resolveScreenName(string $screen_name): object
|
function resolveScreenName(string $screen_name): object
|
||||||
{
|
{
|
||||||
if (\Chandler\MVC\Routing\Router::i()->getMatchingRoute("/$screen_name")[0]->presenter !== "UnknownTextRouteStrategy") {
|
if(\Chandler\MVC\Routing\Router::i()->getMatchingRoute("/$screen_name")[0]->presenter !== "UnknownTextRouteStrategy") {
|
||||||
if (substr($screen_name, 0, strlen("id")) === "id") {
|
if(substr($screen_name, 0, strlen("id")) === "id") {
|
||||||
return (object) [
|
return (object) [
|
||||||
"object_id" => intval(substr($screen_name, strlen("id"))),
|
"object_id" => (int) substr($screen_name, strlen("id")),
|
||||||
"type" => "user"
|
"type" => "user"
|
||||||
];
|
];
|
||||||
} else if (substr($screen_name, 0, strlen("club")) === "club") {
|
} else if(substr($screen_name, 0, strlen("club")) === "club") {
|
||||||
return (object) [
|
return (object) [
|
||||||
"object_id" => intval(substr($screen_name, strlen("club"))),
|
"object_id" => (int) substr($screen_name, strlen("club")),
|
||||||
"type" => "group"
|
"type" => "group"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$alias = (new Aliases)->getByShortCode($screen_name);
|
$alias = (new Aliases)->getByShortCode($screen_name);
|
||||||
if (!$alias) return (object)[];
|
|
||||||
|
if(!$alias) return (object)[];
|
||||||
|
|
||||||
return (object) [
|
return (object) [
|
||||||
"object_id" => $alias->getOwnerId(),
|
"object_id" => $alias->getOwnerId(),
|
||||||
"type" => $alias->getType()
|
"type" => $alias->getType()
|
||||||
|
|
Loading…
Reference in a new issue