Пример #1
0
 private function getAccount($name)
 {
     if ($name) {
         return $this->accountCollecion->get($name);
     }
     return $this->accountCollecion->getDefault();
 }
Пример #2
0
 /**
  * @param array $accounts
  * @return AccountCollection
  * @throws AccountException
  */
 public static function create(array $accounts)
 {
     $accountCollection = new AccountCollection();
     foreach ($accounts as $alias => $info) {
         if (!isset($info['token'])) {
             throw new AccountException("Key 'token' is required for {$alias}.");
         } elseif (!isset($info['account'])) {
             throw new AccountException("Key 'account' is required for {$alias}.");
         }
         $accountCollection->addAccount($alias, new FioAccount($info['account'], $info['token']));
     }
     return $accountCollection;
 }