Passed
Push — master ( df324d...7773d7 )
by Caen
03:06 queued 14s
created

AssetService::stylePath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Hyde\Framework\Services;
4
5
use Hyde\Framework\Contracts\AssetServiceContract;
6
use Hyde\Framework\Hyde;
7
8
/**
9
 * @see \Hyde\Framework\Facades\Asset
10
 */
11
class AssetService implements AssetServiceContract
12
{
13
    /**
14
     * The default HydeFront version to load.
15
     *
16
     * @property string $version HydeFront SemVer Tag
17
     */
18
    public string $version = 'v2.0';
19
20
    public function version(): string
21
    {
22
        return $this->version;
23
    }
24
25
    public function constructCdnPath(string $file): string
26
    {
27
        return 'https://cdn.jsdelivr.net/npm/hydefront@'.$this->version().'/dist/'.$file;
28
    }
29
30
    /**
31
     * Alias for constructCdnPath.
32
     */
33
    public function cdnLink(string $file): string
34
    {
35
        return $this->constructCdnPath($file);
36
    }
37
38
    public function hasMediaFile(string $file): bool
39
    {
40
        return file_exists(Hyde::path('_media').'/'.$file);
41
    }
42
}
43