/** * @param AccountType $type * @return FTry */ protected function checkType(AccountType $type) { return Match::on($type->getValue())->test(AccountType::CR, function () { return FTry::with(AccountType::CR()); })->test(AccountType::DR, function () { return FTry::with(AccountType::DR()); })->any(function () { return FTry::with(new AccountsException(self::ERR_NOTYPE)); })->value(); }