| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3.1825 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | 1 | public function create(bool $global=false):string { |
|
| 23 | 1 | $script="Vue.component('".$this->name."',"; |
|
| 24 | 1 | $script.=JavascriptUtils::arrayToJsObject($this->props + $this->data + $this->methods + $this->computeds + $this->watchers + $this->hooks + $this->template); |
|
| 25 | 1 | $script=JsUtils::cleanJSONFunctions($script); |
|
| 26 | 1 | $script.=")"; |
|
| 27 | 1 | if(!$global){ |
|
| 28 | 1 | \file_put_contents($this->name.".js",$script); |
|
| 29 | } |
||
| 30 | else{ |
||
| 31 | if(file_exists("components.js")){ |
||
| 32 | \file_put_contents("components.js",PHP_EOL . $script,FILE_APPEND); |
||
| 33 | } |
||
| 34 | else{ |
||
| 35 | \file_put_contents("components.js",$script); |
||
| 36 | } |
||
| 37 | |||
| 38 | } |
||
| 39 | 1 | return $script; |
|
| 40 | } |
||
| 45 | } |