Пример #1
0
 public function format(Account $account, array $frontline)
 {
     $profiles = array_map(function (Profile $profile) {
         return $this->profileFormatter->format($profile);
     }, $account->getProfiles()->toArray());
     return ["api_key" => $account->getAPIKey(), "account" => $account->toJSON(), "profiles" => $profiles, "frontline" => $frontline];
 }
Пример #2
0
 public function __invoke() : array
 {
     $currentAccountService = $this->currentAccountService;
     if ($currentAccountService->isAvailable()) {
         return ['auth' => ['api_key' => $currentAccountService->getCurrentAccount()->getAPIKey(), 'account' => $currentAccountService->getCurrentAccount()->toJSON(), 'profiles' => array_map(function (Profile $profile) {
             return $this->profileExtendedFormatter->format($profile);
         }, $currentAccountService->getCurrentAccount()->getProfiles()->toArray())]];
     } else {
         return [];
     }
 }