@@ -74,6 +74,9 @@ |
||
74 | 74 | return (string) $this->execJs->evalJs($code); |
75 | 75 | } |
76 | 76 | |
77 | + /** |
|
78 | + * @param string $bundleSrc |
|
79 | + */ |
|
77 | 80 | private function getSsrCode($bundleSrc, array $store, array $metas) : string |
78 | 81 | { |
79 | 82 | $storeJson = json_encode($store); |
@@ -47,10 +47,10 @@ |
||
47 | 47 | /** |
48 | 48 | * {@inheritdoc} |
49 | 49 | */ |
50 | - public function render(string $appName, array $store, array $metas = []) : string |
|
50 | + public function render(string $appName, array $store, array $metas = [ ]) : string |
|
51 | 51 | { |
52 | 52 | $bundleSrcPath = sprintf('%s/%s.bundle.js', $this->bundleSrcBasePath, $appName); |
53 | - if (! file_exists($bundleSrcPath)) { |
|
53 | + if (!file_exists($bundleSrcPath)) { |
|
54 | 54 | throw new JsFileNotExistsException($bundleSrcPath); |
55 | 55 | } |
56 | 56 | $bundleSrc = file_get_contents($bundleSrcPath); |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * {@inheritdoc} |
41 | 41 | */ |
42 | - public function render(string $appName, array $store, array $metas = []) : string |
|
42 | + public function render(string $appName, array $store, array $metas = [ ]) : string |
|
43 | 43 | { |
44 | - if (! $this->cache->has($appName)) { |
|
44 | + if (!$this->cache->has($appName)) { |
|
45 | 45 | $this->saveSnapshot($appName); |
46 | 46 | } |
47 | 47 | $snapShot = $this->cache->get($appName); |
48 | - $v8 = new V8Js('PHP', [], [], true, $snapShot); |
|
48 | + $v8 = new V8Js('PHP', [ ], [ ], true, $snapShot); |
|
49 | 49 | try { |
50 | 50 | $html = $v8->executeString($this->getSsrCode($store, $metas)); |
51 | 51 | } catch (\V8JsScriptException $e) { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | private function saveSnapshot(string $appName) : void |
63 | 63 | { |
64 | 64 | $bundleSrcPath = sprintf('%s/%s.bundle.js', $this->bundleSrcBasePath, $appName); |
65 | - if (! file_exists($bundleSrcPath)) { |
|
65 | + if (!file_exists($bundleSrcPath)) { |
|
66 | 66 | throw new JsFileNotExistsException($bundleSrcPath); |
67 | 67 | } |
68 | 68 | $bundleSrc = file_get_contents($bundleSrcPath); |
@@ -17,5 +17,5 @@ |
||
17 | 17 | * |
18 | 18 | * @return string |
19 | 19 | */ |
20 | - public function render(string $appName, array $store, array $metas = []) : string; |
|
20 | + public function render(string $appName, array $store, array $metas = [ ]) : string; |
|
21 | 21 | } |