Skip to content

Commit 5bd7def

Browse files
committed
Remove the validate parameter from the mediaLink method
1 parent 06fd95a commit 5bd7def

File tree

5 files changed

+12
-14
lines changed

5 files changed

+12
-14
lines changed

docs/_data/partials/hyde-pages-api/hyde-kernel-hyperlink-methods.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<section id="hyde-kernel-hyperlink-methods">
22

33
<!-- Start generated docs for Hyde\Foundation\Concerns\ForwardsHyperlinks -->
4-
<!-- Generated by HydePHP DocGen script at 2024-07-26 18:20:22 in 0.13ms -->
4+
<!-- Generated by HydePHP DocGen script at 2024-07-26 18:57:46 in 0.11ms -->
55

66
#### `formatLink()`
77

@@ -24,7 +24,7 @@ Hyde::relativeLink(string $destination): string
2424
No description provided.
2525

2626
```php
27-
Hyde::mediaLink(string $destination, bool $validate): string
27+
Hyde::mediaLink(string $destination): string
2828
```
2929

3030
#### `asset()`

packages/framework/src/Foundation/Concerns/ForwardsHyperlinks.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public function relativeLink(string $destination): string
2323
return $this->hyperlinks->relativeLink($destination);
2424
}
2525

26-
public function mediaLink(string $destination, bool $validate = false): string
26+
public function mediaLink(string $destination): string
2727
{
28-
return $this->hyperlinks->mediaLink($destination, $validate);
28+
return $this->hyperlinks->mediaLink($destination);
2929
}
3030

3131
public function asset(string $name): string

packages/framework/src/Foundation/Kernel/Hyperlinks.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ public function relativeLink(string $destination): string
9393
* An exception will be thrown if the file does not exist in the _media directory,
9494
* and the second argument is set to true.
9595
*/
96-
public function mediaLink(string $destination, bool $validate = false): string
96+
public function mediaLink(string $destination): string
9797
{
98-
if ($validate && ! file_exists($sourcePath = "{$this->kernel->getMediaDirectory()}/$destination")) {
98+
if (false && ! file_exists($sourcePath = "{$this->kernel->getMediaDirectory()}/$destination")) {
9999
throw new FileNotFoundException($sourcePath);
100100
}
101101

packages/framework/src/Support/V1Compatibility.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public static function siteMediaPath(string $path = ''): string
3737
return MediaFile::outputPath($path);
3838
}
3939

40-
public static function mediaLink(string $destination, bool $validate = false): string
40+
public static function mediaLink(string $destination): string
4141
{
42-
return HydeKernel::getInstance()->mediaLink($destination, $validate);
42+
return HydeKernel::getInstance()->mediaLink($destination);
4343
}
4444
}

packages/framework/tests/Feature/Foundation/HyperlinksTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Hyde\Foundation\HydeKernel;
88
use Hyde\Foundation\Facades\Routes;
99
use Hyde\Foundation\Kernel\Hyperlinks;
10-
use Hyde\Framework\Exceptions\FileNotFoundException;
1110
use Hyde\Hyde;
1211
use Hyde\Testing\TestCase;
1312

@@ -105,16 +104,15 @@ public function testMediaLinkHelperUsesConfiguredMediaDirectory()
105104
$this->assertSame('assets/foo', $this->class->mediaLink('foo'));
106105
}
107106

108-
public function testMediaLinkHelperWithValidationAndExistingFile()
107+
public function testMediaLinkHelperWithExistingFile()
109108
{
110109
$this->file('_media/foo');
111-
$this->assertSame('media/foo', $this->class->mediaLink('foo', true));
110+
$this->assertSame('media/foo', $this->class->mediaLink('foo'));
112111
}
113112

114-
public function testMediaLinkHelperWithValidationAndNonExistingFile()
113+
public function testMediaLinkHelperWithNonExistingFile()
115114
{
116-
$this->expectException(FileNotFoundException::class);
117-
$this->class->mediaLink('foo', true);
115+
$this->assertSame('media/foo', $this->class->mediaLink('foo'));
118116
}
119117

120118
public function testRouteHelper()

0 commit comments

Comments
 (0)