2020-08-12 14:36:18 +03:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
namespace openvk\VKAPI\Handlers;
|
|
|
|
|
|
|
|
final class Account extends VKAPIRequestHandler
|
|
|
|
{
|
|
|
|
function getProfileInfo(): object
|
|
|
|
{
|
|
|
|
$this->requireUser();
|
|
|
|
|
|
|
|
return (object) [
|
2022-07-21 22:13:09 +03:00
|
|
|
"first_name" => $this->getUser()->getFirstName(),
|
|
|
|
"id" => $this->getUser()->getId(),
|
|
|
|
"last_name" => $this->getUser()->getLastName(),
|
|
|
|
"home_town" => $this->getUser()->getHometown(),
|
|
|
|
"status" => $this->getUser()->getStatus(),
|
2022-08-11 23:20:36 +03:00
|
|
|
"bdate" => $this->getUser()->getBirthday()->format('%e.%m.%Y'),
|
|
|
|
"bdate_visibility" => $this->getUser()->getBirthdayPrivacy(),
|
2022-07-21 22:13:09 +03:00
|
|
|
"phone" => "+420 ** *** 228", # TODO
|
|
|
|
"relation" => $this->getUser()->getMaritalStatus(),
|
|
|
|
"sex" => $this->getUser()->isFemale() ? 1 : 2
|
2020-08-12 14:36:18 +03:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
function getInfo(): object
|
|
|
|
{
|
|
|
|
$this->requireUser();
|
|
|
|
|
|
|
|
return (object) [
|
2022-08-11 23:20:36 +03:00
|
|
|
"2fa_required" => $this->getUser()->is2faEnabled() ? 1 : 0,
|
2022-07-21 22:13:09 +03:00
|
|
|
"country" => "CZ", # TODO
|
|
|
|
"eu_user" => false, # TODO
|
|
|
|
"https_required" => 1,
|
|
|
|
"intro" => 0,
|
|
|
|
"community_comments" => false,
|
|
|
|
"is_live_streaming_enabled" => false,
|
2020-08-12 14:36:18 +03:00
|
|
|
"is_new_live_streaming_enabled" => false,
|
2022-07-21 22:13:09 +03:00
|
|
|
"lang" => 1,
|
|
|
|
"no_wall_replies" => 0,
|
|
|
|
"own_posts_default" => 0
|
2020-08-12 14:36:18 +03:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2021-10-08 23:17:45 +03:00
|
|
|
function setOnline(): int
|
2020-08-12 14:36:18 +03:00
|
|
|
{
|
|
|
|
$this->requireUser();
|
|
|
|
|
|
|
|
$this->getUser()->setOnline(time());
|
2022-08-13 05:41:59 +03:00
|
|
|
$this->getUser()->save();
|
|
|
|
|
2020-08-12 14:36:18 +03:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setOffline(): object
|
|
|
|
{
|
|
|
|
$this->requireUser();
|
|
|
|
|
2022-05-08 13:06:26 +03:00
|
|
|
# Цiй метод є заглушка
|
2020-08-12 14:36:18 +03:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2022-03-29 12:26:29 +03:00
|
|
|
function getAppPermissions(): int
|
2020-08-12 14:36:18 +03:00
|
|
|
{
|
|
|
|
return 9355263;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getCounters(string $filter = ""): object
|
|
|
|
{
|
|
|
|
return (object) [
|
2022-07-21 22:13:09 +03:00
|
|
|
"friends" => $this->getUser()->getFollowersCount(),
|
2021-01-17 01:11:04 +03:00
|
|
|
"notifications" => $this->getUser()->getNotificationsCount(),
|
2022-07-21 22:13:09 +03:00
|
|
|
"messages" => $this->getUser()->getUnreadMessagesCount()
|
2020-08-12 14:36:18 +03:00
|
|
|
];
|
|
|
|
|
2022-05-08 13:06:26 +03:00
|
|
|
# TODO: Filter
|
2020-08-12 14:36:18 +03:00
|
|
|
}
|
|
|
|
}
|