Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

Commit 67da9f9

Browse files
authored
Create LinkRequest.php
href trimming
1 parent df7321b commit 67da9f9

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

source/NavigationBuilder/Requests/LinkRequest.php

+1-17
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,10 @@ class LinkRequest extends RequestFilter
2020

2121
const SETTERS = [
2222
'text' => 'trim',
23-
'href' => [self::class, 'trimHref'],
23+
'href' => 'trim',
2424
'attributes' => [self::class, 'trimAttributes'],
2525
];
2626

27-
/**
28-
* @param string $value
29-
* @return string
30-
*/
31-
public static function trimHref(string $value): string
32-
{
33-
$value = trim($value, ' /');
34-
if (stripos($value, 'http://') === 0 || stripos($value, 'https://') === 0) {
35-
//absolute path
36-
return $value;
37-
}
38-
39-
//relative path
40-
return '/' . $value;
41-
}
42-
4327
/**
4428
* @param array $attributes
4529
* @return array

0 commit comments

Comments
 (0)