Skip to content

Commit

Permalink
Simplify helper method implementation
Browse files Browse the repository at this point in the history
With the private API we can now use a more specific and cleaner implementation
  • Loading branch information
caendesilva committed Jul 26, 2024
1 parent 84a6864 commit 324b316
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/framework/src/Facades/HydeFront.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

namespace Hyde\Facades;

use function str_replace;
use function sprintf;

class HydeFront
{
/** @var string The default HydeFront SemVer tag to load. This constant is set to match the styles used for the installed framework version. */
protected const HYDEFRONT_VERSION = 'v3.4';

/** @var string The default HydeFront CDN path pattern. The Blade-style placeholders are replaced with the proper values. */
protected const HYDEFRONT_CDN_URL = 'https://cdn.jsdelivr.net/npm/hydefront@{{ $version }}/dist/{{ $file }}';
/** @var string The default HydeFront CDN path pattern. */
protected const HYDEFRONT_CDN_URL = 'https://cdn.jsdelivr.net/npm/hydefront@%s/dist/%s';

public static function version(): string
{
Expand All @@ -21,9 +21,6 @@ public static function version(): string

public static function cdnLink(string $file): string
{
return str_replace(
['{{ $version }}', '{{ $file }}'], [static::version(), $file],
static::HYDEFRONT_CDN_URL
);
return sprintf(static::HYDEFRONT_CDN_URL, static::version(), $file);
}
}

0 comments on commit 324b316

Please sign in to comment.