Skip to content

Commit 87d846f

Browse files
committed
Improve syntax
1 parent 42ad784 commit 87d846f

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/CodeigniterVite.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44

55
class CodeigniterVite
66
{
7+
8+
/**
9+
* @var string manifest path.
10+
*/
11+
private static $manifest;
12+
13+
public function __construct()
14+
{
15+
static::$manifest = is_file(FCPATH . 'manifest.json') ? FCPATH . 'manifest.json' : null;
16+
}
17+
718
/**
819
* Get vite entry file on running or bundled files instead.
920
*
@@ -23,10 +34,10 @@ public static function tags()
2334
}
2435

2536
# If vite isn't running, then return the compiled resources.
26-
if (empty($result) && static::manifest())
37+
if (empty($result) && static::$manifest)
2738
{
2839
# Get the manifest content.
29-
$manifest = file_get_contents(static::manifest());
40+
$manifest = file_get_contents(static::$manifest);
3041
# You look much pretty as an php object =).
3142
$manifest = json_decode($manifest);
3243

@@ -67,12 +78,4 @@ public static function getReactTag()
6778

6879
return null;
6980
}
70-
71-
/**
72-
* @return string manifest path
73-
*/
74-
private static function manifest()
75-
{
76-
return is_file(FCPATH . 'manifest.json') ? FCPATH . 'manifest.json' : null;
77-
}
7881
}

0 commit comments

Comments
 (0)