Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
7 / 7
CRAP
100.00% covered (success)
100.00%
1 / 1
ForwardsHyperlinks
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
7 / 7
7
100.00% covered (success)
100.00%
1 / 1
 formatLink
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 relativeLink
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 mediaLink
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 asset
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 url
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 route
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 hasSiteUrl
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Hyde\Foundation\Concerns;
6
7use Hyde\Support\Models\Route;
8use JetBrains\PhpStorm\Deprecated;
9
10/**
11 * @internal Single-use trait for the HydeKernel class.
12 *
13 * @see \Hyde\Foundation\HydeKernel
14 */
15trait ForwardsHyperlinks
16{
17    public function formatLink(string $destination): string
18    {
19        return $this->hyperlinks->formatLink($destination);
20    }
21
22    public function relativeLink(string $destination): string
23    {
24        return $this->hyperlinks->relativeLink($destination);
25    }
26
27    /**
28     * @deprecated This method will be removed in v2.0. Please use `asset()` instead.
29     */
30    #[Deprecated(reason: 'Use `asset` method instead.', replacement: '%class%::asset(%parameter0%)')]
31    public function mediaLink(string $destination, bool $validate = false): string
32    {
33        trigger_deprecation('hyde/framework', '1.8.0', 'The %s() method is deprecated, use %s() instead.', __METHOD__, 'asset');
34
35        return $this->hyperlinks->mediaLink($destination, $validate);
36    }
37
38    public function asset(string $name, bool $preferQualifiedUrl = false): string
39    {
40        return $this->hyperlinks->asset($name, $preferQualifiedUrl);
41    }
42
43    public function url(string $path = ''): string
44    {
45        return $this->hyperlinks->url($path);
46    }
47
48    public function route(string $key): ?Route
49    {
50        return $this->hyperlinks->route($key);
51    }
52
53    public function hasSiteUrl(): bool
54    {
55        return $this->hyperlinks->hasSiteUrl();
56    }
57}