Total Complexity | 6 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Coverage | 58.81% |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
16 | class ReactComponent extends ReactClass { |
||
17 | |||
18 | private $react; |
||
19 | |||
20 | 4 | public function __construct(string $name, ReactJS $react) { |
|
21 | 4 | parent::__construct($name, 'React.Component'); |
|
22 | 4 | $this->react = $react; |
|
23 | 4 | } |
|
24 | |||
25 | /** |
||
26 | * Add the constructor. |
||
27 | * |
||
28 | * @param string $jsBody |
||
29 | * The Javascript code body |
||
30 | */ |
||
31 | 3 | public function addConstructor(string $jsBody): void { |
|
33 | 3 | } |
|
34 | |||
35 | /** |
||
36 | * Add the render method. |
||
37 | * |
||
38 | * @param string $jsxHtml |
||
39 | * The JSX code to render |
||
40 | * @param string $jsInit |
||
41 | * Javascript code intialization before render |
||
42 | */ |
||
43 | 4 | public function addRender(string $jsxHtml, string $jsInit = ''): void { |
|
45 | 4 | } |
|
46 | |||
47 | /** |
||
48 | * Add the componentDidMount method. |
||
49 | * |
||
50 | * @param string $jsBody |
||
51 | * The Javascript code body |
||
52 | */ |
||
53 | public function onComponentDidMount(string $jsBody): void { |
||
54 | $this->addMethod('componentDidMount', $jsBody); |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Add the componentWillUnmount method. |
||
59 | * |
||
60 | * @param string $jsBody |
||
61 | * The Javascript code body |
||
62 | */ |
||
63 | public function onComponentWillUnmount(string $jsBody): void { |
||
64 | $this->addMethod('componentWillUnmount', $jsBody); |
||
65 | } |
||
66 | |||
67 | public function setState(array $states) {} |
||
68 | } |
||
69 | |||
70 |