1 | <?php |
||
30 | class GatewayFactory |
||
31 | { |
||
32 | /** |
||
33 | * Internal storage for all available gateways |
||
34 | * |
||
35 | * @var array |
||
36 | */ |
||
37 | private $gateways = array(); |
||
38 | |||
39 | /** |
||
40 | * All available gateways |
||
41 | * |
||
42 | * @return array An array of gateway names |
||
43 | */ |
||
44 | 9 | public function all() |
|
48 | |||
49 | /** |
||
50 | * Replace the list of available gateways |
||
51 | * |
||
52 | * @param array $gateways An array of gateway names |
||
53 | */ |
||
54 | 3 | public function replace(array $gateways) |
|
58 | |||
59 | /** |
||
60 | * Register a new gateway |
||
61 | * |
||
62 | * @param string $className Gateway name |
||
63 | */ |
||
64 | 6 | public function register($className) |
|
70 | |||
71 | /** |
||
72 | * Create a new gateway instance |
||
73 | * |
||
74 | * @param string $class Gateway name |
||
75 | * @param ClientInterface|null $httpClient A HTTP Client implementation |
||
76 | * @param HttpRequest|null $httpRequest A Symfony HTTP Request implementation |
||
77 | * @throws RuntimeException If no such gateway is found |
||
78 | * @return GatewayInterface An object of class $class is created and returned |
||
79 | */ |
||
80 | 9 | public function create($class, ClientInterface $httpClient = null, HttpRequest $httpRequest = null) |
|
90 | } |
||
91 |