Conditions | 7 |
Paths | 28 |
Total Lines | 32 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
5 | function mix($path, $json = false, $shouldHotReload = false) |
||
6 | { |
||
7 | if (! $json) static $json; |
||
8 | if (! $shouldHotReload) static $shouldHotReload; |
||
9 | |||
10 | if (! $json) { |
||
11 | $manifestPath = public_path('manifest.json'); |
||
12 | $shouldHotReload = file_exists(public_path('hot')); |
||
13 | |||
14 | if (! file_exists($manifestPath)) { |
||
15 | throw new Exception( |
||
16 | 'The Laravel Mix manifest file does not exist. ' . |
||
17 | 'Please run "npm run webpack" and try again.' |
||
18 | ); |
||
19 | } |
||
20 | |||
21 | $json = json_decode(file_get_contents($manifestPath), true); |
||
22 | } |
||
23 | |||
24 | $path = pathinfo($path, PATHINFO_BASENAME); |
||
25 | |||
26 | if (! array_key_exists($path, $json)) { |
||
27 | throw new Exception( |
||
28 | 'Unknown file path. Please check your requested ' . |
||
29 | 'webpack.mix.js output path, and try again.' |
||
30 | ); |
||
31 | } |
||
32 | |||
33 | return $shouldHotReload |
||
34 | ? "http://localhost:8080{$json[$path]}" |
||
35 | : url($json[$path]); |
||
36 | } |
||
37 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.