Total Complexity | 8 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 8 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | class VueJS extends AbstractVueJS { |
||
16 | |||
17 | protected bool $useAxios; |
||
18 | |||
19 | protected array $configuration; |
||
20 | |||
21 | 12 | public function __construct(string $app = "#app", bool $vuetify = false, bool $useAxios = false) { |
|
22 | 12 | parent::__construct(); |
|
23 | 12 | $this->configuration['el'] = '"' . $app . '"'; |
|
24 | 12 | if ($vuetify) { |
|
25 | 12 | $this->configuration['vuetify'] = "new Vuetify()"; |
|
26 | } |
||
27 | 12 | $this->useAxios = $useAxios; |
|
28 | 12 | } |
|
29 | |||
30 | 1 | public function __toString(): string { |
|
31 | 1 | $script = ""; |
|
32 | 1 | if ($this->useAxios) { |
|
33 | 1 | $script .= "Vue.prototype.\$http = axios;\n"; |
|
34 | } |
||
35 | 1 | $script .= "const app=new Vue("; |
|
36 | 1 | $script .= JavascriptUtils::arrayToJsObject($this->configuration + $this->data + $this->methods + $this->directives + $this->watchers + $this->filters + $this->computeds + $this->hooks); |
|
37 | 1 | $script = JsUtils::cleanJSONFunctions($script); |
|
38 | 1 | $script .= ")"; |
|
39 | 1 | $script = JavascriptUtils::wrapScript($script); |
|
40 | 1 | return $script; |
|
41 | } |
||
42 | |||
43 | 1 | public function getUseAxios(): bool { |
|
45 | } |
||
46 | |||
47 | 2 | public function setUseAxios(bool $useAxios): void { |
|
48 | 2 | $this->useAxios = $useAxios; |
|
49 | 2 | } |
|
50 | |||
51 | 1 | public function getConfiguration(): array { |
|
53 | } |
||
54 | |||
55 | 1 | public function setConfiguration(array $configuration): void { |
|
57 | } |
||
58 | } |