Total Complexity | 4 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | trait HasFactoryTrait |
||
12 | { |
||
13 | /** |
||
14 | * Internal factory storage |
||
15 | * |
||
16 | * @var GatewayFactory |
||
17 | */ |
||
18 | protected $factory; |
||
19 | |||
20 | /** |
||
21 | * Get the gateway factory |
||
22 | * |
||
23 | * Creates a new empty GatewayFactory if none has been set previously. |
||
24 | * |
||
25 | * @return GatewayFactory A GatewayFactory instance |
||
26 | */ |
||
27 | public static function factory(): GatewayFactory |
||
28 | { |
||
29 | return static::instance()->getFactory(); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Get the gateway factory |
||
34 | * |
||
35 | * Creates a new empty GatewayFactory if none has been set previously. |
||
36 | * |
||
37 | * @return GatewayFactory A GatewayFactory instance |
||
38 | */ |
||
39 | public function getFactory(): GatewayFactory |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @param GatewayFactory $factory |
||
50 | */ |
||
51 | public function setFactory(GatewayFactory $factory): void |
||
54 | } |
||
55 | } |
||
56 |