Total Complexity | 4 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | abstract class AbstractFfi |
||
8 | { |
||
9 | private \FFI $ffi; |
||
10 | |||
11 | /** |
||
12 | * Represents each class CData. For example, in class Space it represents a cpSpace struct. |
||
13 | */ |
||
14 | private \FFI\CData $cData; |
||
15 | |||
16 | public function __construct() |
||
17 | { |
||
18 | $this->ffi = Environment::getFfi(); |
||
19 | } |
||
20 | |||
21 | public function getFfi(): \FFI |
||
22 | { |
||
23 | return $this->ffi; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Should be used internally by the wrapper. It allows for example, to receive |
||
28 | * a Vector class from the Space class and get the Vector's CData to set the |
||
29 | * Space's gravity. |
||
30 | */ |
||
31 | public function getCData(): \FFI\CData |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Should be called at every class constructor to have the required CData to |
||
38 | * work with the FFI. |
||
39 | */ |
||
40 | protected function setCData(\FFI\CData $cData): void |
||
43 | } |
||
44 | } |
||
45 |