| Total Complexity | 5 |
| Total Lines | 87 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | trait UsesTokens |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Monzo client ID. |
||
| 11 | * |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | protected $id; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Monzo client secret. |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected $secret; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * The API token we're using. |
||
| 25 | * |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | protected $token; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Set the token for this request. |
||
| 32 | * |
||
| 33 | * @param string $token |
||
| 34 | * @return ClientContract|$this |
||
| 35 | */ |
||
| 36 | public function token(string $token) |
||
| 37 | { |
||
| 38 | $this->token = $token; |
||
| 39 | |||
| 40 | return $this; |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Issue an oauth request with client params set. |
||
| 45 | * |
||
| 46 | * @param string $refreshToken |
||
| 47 | * @return array an array with refresh_token and access_token values. |
||
| 48 | */ |
||
| 49 | public function refresh(string $refreshToken) |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Set the client ID. |
||
| 66 | * |
||
| 67 | * @param string $id |
||
| 68 | * @return void |
||
| 69 | */ |
||
| 70 | public function setClientId(string $id) |
||
| 71 | { |
||
| 72 | $this->id = $id; |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * Get the client ID. |
||
| 77 | * |
||
| 78 | * @return string |
||
| 79 | */ |
||
| 80 | public function getClientId() |
||
| 83 | } |
||
| 84 | |||
| 85 | /** |
||
| 86 | * Set the client secret. |
||
| 87 | * |
||
| 88 | * @param string $secret |
||
| 89 | * @return void |
||
| 90 | */ |
||
| 91 | public function setClientSecret(string $secret) |
||
| 94 | } |
||
| 95 | } |
||
| 96 |