Total Complexity | 3 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Coverage | 75% |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
16 | class ReactComponent extends ReactClass { |
||
17 | |||
18 | 1 | public function __construct(string $name) { |
|
19 | 1 | parent::__construct($name, 'React.Component'); |
|
20 | 1 | } |
|
21 | |||
22 | /** |
||
23 | * Add the constructor. |
||
24 | * |
||
25 | * @param string $jsBody |
||
26 | * The Javascript code body |
||
27 | */ |
||
28 | 1 | public function addConstructor(string $jsBody): void { |
|
29 | 1 | $this->addMethod('constructor', "\tsuper(props);\n" . $jsBody, 'props'); |
|
30 | 1 | } |
|
31 | |||
32 | /** |
||
33 | * Add the render method. |
||
34 | * |
||
35 | * @param string $jsxHtml |
||
36 | * The JSX code to render |
||
37 | * @param string $jsInit |
||
38 | * Javascript code intialization before render |
||
39 | */ |
||
40 | public function addRender(string $jsxHtml, string $jsInit = ''): void { |
||
42 | } |
||
43 | } |
||
44 | |||
45 |