Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the UriNormalize filter #131

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"require-dev": {
"laminas/laminas-coding-standard": "~2.5.0",
"laminas/laminas-i18n": "^2.26.0",
"laminas/laminas-uri": "^2.11.0",
"pear/archive_tar": "^1.4.14",
"phpunit/phpunit": "^10.5.11",
"psalm/plugin-phpunit": "^0.19.0",
Expand All @@ -53,7 +52,6 @@
},
"suggest": {
"laminas/laminas-i18n": "Laminas\\I18n component for filters depending on i18n functionality",
"laminas/laminas-uri": "Laminas\\Uri component, for the UriNormalize filter",
"psr/http-factory-implementation": "psr/http-factory-implementation, for creating file upload instances when consuming PSR-7 in file upload filters"
},
"autoload": {
Expand Down
206 changes: 1 addition & 205 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 0 additions & 24 deletions docs/book/v3/standard-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -1464,27 +1464,3 @@ print $filter->filter($input);
The above will return
`A text with a <img src='picture.com' width='100'>picture</img> click <a href='<http://picture.com/laminas>'>here</a>!`
as the result.

## UriNormalize

This filter sets the scheme on a URI if the scheme is missing.

### Supported Options

The following options are supported for `Laminas\Filter\UriNormalize`:

- `defaultScheme`: This option can be used to set the default scheme to use when
parsing scheme-less URIs.
- `enforcedScheme`: Set a URI scheme to enforce on schemeless URIs.

### Basic Usage

```php
$filter = new Laminas\Filter\UriNormalize(array(
'enforcedScheme' => 'https'
));

echo $filter->filter('www.example.com');
```

The above results in the string `https://www.example.com`.
27 changes: 0 additions & 27 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -809,26 +809,6 @@
<code><![CDATA[$encodingOrOptions]]></code>
</PossiblyInvalidArgument>
</file>
<file src="src/UriNormalize.php">
<InvalidCatch>
<code><![CDATA[try {
$uri = UriFactory::factory($value, $defaultScheme);
if ($this->enforcedScheme !== null && $uri->getScheme() === null) {
$this->enforceScheme($uri);
}
} catch (UriException) {
// We are unable to parse / enforce scheme with the given config and input
return $value;
}]]></code>
</InvalidCatch>
<PossiblyNullArgument>
<code><![CDATA[$defaultScheme]]></code>
</PossiblyNullArgument>
<PossiblyUnusedMethod>
<code><![CDATA[setDefaultScheme]]></code>
<code><![CDATA[setEnforcedScheme]]></code>
</PossiblyUnusedMethod>
</file>
<file src="src/Word/AbstractSeparator.php">
<PossiblyInvalidArgument>
<code><![CDATA[$separator]]></code>
Expand Down Expand Up @@ -1323,13 +1303,6 @@
<code><![CDATA[returnUnfilteredDataProvider]]></code>
</PossiblyUnusedMethod>
</file>
<file src="test/UriNormalizeTest.php">
<PossiblyUnusedMethod>
<code><![CDATA[abnormalUriProvider]]></code>
<code><![CDATA[enforcedSchemeTestcaseProvider]]></code>
<code><![CDATA[returnUnfilteredDataProvider]]></code>
</PossiblyUnusedMethod>
</file>
<file src="test/Word/CamelCaseToSeparatorTest.php">
<PossiblyUnusedMethod>
<code><![CDATA[returnNonStringScalarValues]]></code>
Expand Down
7 changes: 0 additions & 7 deletions src/FilterPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ final class FilterPluginManager extends AbstractPluginManager
'uppercasewords' => UpperCaseWords::class,
'upperCaseWords' => UpperCaseWords::class,
'UpperCaseWords' => UpperCaseWords::class,
'urinormalize' => UriNormalize::class,
'uriNormalize' => UriNormalize::class,
'UriNormalize' => UriNormalize::class,
'wordcamelcasetodash' => Word\CamelCaseToDash::class,
'wordCamelCaseToDash' => Word\CamelCaseToDash::class,
'WordCamelCaseToDash' => Word\CamelCaseToDash::class,
Expand Down Expand Up @@ -227,7 +224,6 @@ final class FilterPluginManager extends AbstractPluginManager
'Zend\Filter\StringTrim' => StringTrim::class,
'Zend\Filter\StripNewlines' => StripNewlines::class,
'Zend\Filter\StripTags' => StripTags::class,
'Zend\Filter\UriNormalize' => UriNormalize::class,
'Zend\Filter\Word\CamelCaseToDash' => Word\CamelCaseToDash::class,
'Zend\Filter\Word\CamelCaseToSeparator' => Word\CamelCaseToSeparator::class,
'Zend\Filter\Word\CamelCaseToUnderscore' => Word\CamelCaseToUnderscore::class,
Expand Down Expand Up @@ -278,7 +274,6 @@ final class FilterPluginManager extends AbstractPluginManager
'zendfilterstripnewlines' => StripNewlines::class,
'zendfilterstriptags' => StripTags::class,
'zendfilteruppercasewords' => UpperCaseWords::class,
'zendfilterurinormalize' => UriNormalize::class,
'zendfilterwordcamelcasetodash' => Word\CamelCaseToDash::class,
'zendfilterwordcamelcasetoseparator' => Word\CamelCaseToSeparator::class,
'zendfilterwordcamelcasetounderscore' => Word\CamelCaseToUnderscore::class,
Expand Down Expand Up @@ -343,7 +338,6 @@ final class FilterPluginManager extends AbstractPluginManager
StripTags::class => InvokableFactory::class,
ToInt::class => InvokableFactory::class,
ToNull::class => InvokableFactory::class,
UriNormalize::class => InvokableFactory::class,
Word\CamelCaseToDash::class => InvokableFactory::class,
Word\CamelCaseToSeparator::class => InvokableFactory::class,
Word\CamelCaseToUnderscore::class => InvokableFactory::class,
Expand Down Expand Up @@ -394,7 +388,6 @@ final class FilterPluginManager extends AbstractPluginManager
'laminasfilterstripnewlines' => InvokableFactory::class,
'laminasfilterstriptags' => InvokableFactory::class,
'laminasfilteruppercasewords' => InvokableFactory::class,
'laminasfilterurinormalize' => InvokableFactory::class,
'laminasfilterwordcamelcasetodash' => InvokableFactory::class,
'laminasfilterwordcamelcasetoseparator' => InvokableFactory::class,
'laminasfilterwordcamelcasetounderscore' => InvokableFactory::class,
Expand Down
Loading