Completed
Branch 1.x (d3aae8)
by Akihito
03:42
created
src/Baracoa.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -74,6 +74,9 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,10 +47,10 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
docs/example/min/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,6 +5,6 @@
 block discarded – undo
5 5
 use Koriym\Baracoa\Baracoa;
6 6
 
7 7
 $baracoa = new Baracoa(__DIR__, new ExceptionHandler());
8
-$state = ['name' => 'World'];
8
+$state = [ 'name' => 'World' ];
9 9
 
10 10
 echo $baracoa->render('min_ssr', $state) . PHP_EOL;
Please login to merge, or discard this patch.
docs/example/redux/public/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 
7 7
 $jsBundleDir = __DIR__ . '/build';
8 8
 $baracoa = new Baracoa($jsBundleDir, new ExceptionHandler(), new V8Js());
9
-$state = ['hello' => ['name' => 'SSR']];
10
-$metas = ['title' => '<page-title>'];
9
+$state = [ 'hello' => [ 'name' => 'SSR' ] ];
10
+$metas = [ 'title' => '<page-title>' ];
11 11
 $html = $baracoa->render('index_ssr', $state, $metas);
12 12
 
13 13
 echo $html;
Please login to merge, or discard this patch.
docs/example/redux/public/cache.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@
 block discarded – undo
7 7
 
8 8
 $jsBundleDir = __DIR__ . '/build';
9 9
 $baracoa = new CacheBaracoa($jsBundleDir, new ExceptionHandler(), new FilesystemCache());
10
-$state = ['hello' => ['name' => 'SSR']];
11
-$metas = ['title' => '<page-title>'];
10
+$state = [ 'hello' => [ 'name' => 'SSR' ] ];
11
+$metas = [ 'title' => '<page-title>' ];
12 12
 $html = $baracoa->render('index_ssr', $state, $metas);
13 13
 
14 14
 echo $html;
Please login to merge, or discard this patch.
docs/example/handlesbar/public/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,6 +6,6 @@
 block discarded – undo
6 6
 
7 7
 $jsBundleDir = __DIR__ . '/build';
8 8
 $baracoa = new Baracoa($jsBundleDir, new ExceptionHandler());
9
-$html = $baracoa->render('handlesbar', ['name' => 'Handlebar']);
9
+$html = $baracoa->render('handlesbar', [ 'name' => 'Handlebar' ]);
10 10
 
11 11
 echo $html;
Please login to merge, or discard this patch.
src/CacheBaracoa.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/ExceptionHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     {
13 13
         $erroCode = mb_strimwidth($e->getJsSourceLine(), $e->getJsStartColumn(), 240, '...');
14 14
         $errorMsg = sprintf(
15
-            "%s\n%s\nJS Stack trace:\n%s" ,
15
+            "%s\n%s\nJS Stack trace:\n%s",
16 16
             $e->getMessage(),
17 17
             $erroCode,
18 18
             $e->getJsTrace()
Please login to merge, or discard this patch.
src/BaracoaInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,5 +17,5 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.