Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
36 | protected function getAccountId() |
||
37 | { |
||
38 | if ($this->account) { |
||
39 | return $this->account; |
||
40 | } |
||
41 | |||
42 | $accounts = $this->accounts(); |
||
43 | |||
44 | $account = $accounts->first(function (Account $account) { |
||
45 | return $account->type === 'uk_retail'; |
||
46 | }); |
||
47 | |||
48 | if ($account === null) { |
||
49 | throw new MonzoException('The given user has no accounts. Did you use the correct email for auth?'); |
||
50 | } |
||
51 | |||
52 | return $this->account = $account->id; |
||
53 | } |
||
55 |