brucepc /
sum-up
| 1 | <?php |
||
| 2 | |||
| 3 | namespace BPCI\SumUp; |
||
| 4 | |||
| 5 | use GuzzleHttp\Client; |
||
| 6 | use GuzzleHttp\ClientInterface; |
||
| 7 | |||
| 8 | class SumUp |
||
| 9 | { |
||
| 10 | const VERSION = 'v0.1'; |
||
| 11 | const ENTRYPOINT = 'https://api.sumup.com/'; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @param array $options |
||
| 15 | * @return ClientInterface |
||
| 16 | */ |
||
| 17 | 6 | static function getClient(array $options = []): ClientInterface |
|
|
0 ignored issues
–
show
|
|||
| 18 | { |
||
| 19 | 6 | $options = array_merge_recursive( |
|
| 20 | [ |
||
| 21 | 6 | 'base_uri' => self::getEntrypoint(), |
|
| 22 | 6 | 'timeout' => 2 |
|
| 23 | ], |
||
| 24 | 6 | $options |
|
| 25 | ); |
||
| 26 | |||
| 27 | 6 | return new Client($options); |
|
| 28 | } |
||
| 29 | |||
| 30 | 7 | static function getEntrypoint(): string |
|
|
0 ignored issues
–
show
|
|||
| 31 | { |
||
| 32 | 7 | return self::ENTRYPOINT.self::VERSION.'/'; |
|
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.