diff options
| -rw-r--r-- | src/File.php | 19 | ||||
| -rw-r--r-- | src/ScriptFile.php | 7 | ||||
| -rw-r--r-- | src/StyleFile.php | 7 | 
3 files changed, 14 insertions, 19 deletions
| diff --git a/src/File.php b/src/File.php index b2c52fc..85738f6 100644 --- a/src/File.php +++ b/src/File.php @@ -6,23 +6,28 @@ use Illuminate\Contracts\Support\Htmlable;  abstract class File implements Htmlable  { -    private string $path; +    private string $url; -    protected function setPath(string $path): void +    public function __construct(string $path)      { -        $this->path = $path; +        $this->setUrl($path);      } -    public function getPath(): string +    protected function setUrl(string $url): void      { -        return $this->path; +        $this->url = $url; +    } + +    public function getUrl(): string +    { +        return $this->url;      }      public function hash(): string      {          $class = static::class; -        return md5("{$class}|{$this->path}"); +        return md5("{$class}|{$this->url}");      } -    abstract public function toHtml(): string +    abstract public function toHtml(): string;  } diff --git a/src/ScriptFile.php b/src/ScriptFile.php index f8f11cd..b1c4449 100644 --- a/src/ScriptFile.php +++ b/src/ScriptFile.php @@ -4,14 +4,9 @@ namespace Lightscale\LaralightAssets;  class ScriptFile extends File  { -    public function __construct(string $path) -    { -        $this->setPath($path); -    } -      public function toHtml(): string      { -        $path = $this->getPath(); +        $path = $this->getUrl();          return "<script src=\"{$path}\"></script>";      }  } diff --git a/src/StyleFile.php b/src/StyleFile.php index ea3e425..0007215 100644 --- a/src/StyleFile.php +++ b/src/StyleFile.php @@ -4,14 +4,9 @@ namespace Lightscale\LaralightAssets;  class StyleFile extends File  { -    public function __construct(string $path) -    { -        $this->setPath($path); -    } -      public function toHtml(): string      { -        $path = $this->getPath(); +        $path = $this->getUrl();          return "<link type=\"text/css\" rel=\"stylesheet\" href=\"{$path}\" />";      }  } | 
