From bf30cfd8a451c104ba8e8d9d65d4514e60bb9b83 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 11 Feb 2022 10:01:39 +0000 Subject: more composer updates --- vendor/voku/portable-ascii/.whitesource | 12 +++ vendor/voku/portable-ascii/CHANGELOG.md | 14 ++++ vendor/voku/portable-ascii/README.md | 16 ++-- vendor/voku/portable-ascii/build/docs/base.md | 4 +- .../voku/portable-ascii/src/voku/helper/ASCII.php | 92 ++++++++++++++++++---- 5 files changed, 112 insertions(+), 26 deletions(-) create mode 100644 vendor/voku/portable-ascii/.whitesource (limited to 'vendor/voku/portable-ascii') diff --git a/vendor/voku/portable-ascii/.whitesource b/vendor/voku/portable-ascii/.whitesource new file mode 100644 index 000000000..55b922e8c --- /dev/null +++ b/vendor/voku/portable-ascii/.whitesource @@ -0,0 +1,12 @@ +{ + "scanSettings": { + "baseBranches": [] + }, + "checkRunSettings": { + "vulnerableCheckRunConclusionLevel": "failure", + "displayMode": "diff" + }, + "issueSettings": { + "minSeverityLevel": "LOW" + } +} \ No newline at end of file diff --git a/vendor/voku/portable-ascii/CHANGELOG.md b/vendor/voku/portable-ascii/CHANGELOG.md index 6e5357d08..04b64acdd 100644 --- a/vendor/voku/portable-ascii/CHANGELOG.md +++ b/vendor/voku/portable-ascii/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +### 1.6.1 (2021-01-24) + +- revert: prefer "Russian - Passport (2013), ICAO" instead of "Russian - GOST 7.79-2000(B)" +- revert: fix "Ukrainian" char-mapping (thanks to @Andr1yk0) +- revert: fix "Persian" char-mapping (thanks to @frost-cyber) + +### 1.6.0 (2021-01-24) + +- prefer "Russian - Passport (2013), ICAO" instead of "Russian - GOST 7.79-2000(B)" +- fix "Ukrainian" char-mapping (thanks to @Andr1yk0) +- fix "Persian" char-mapping (thanks to @frost-cyber) +- fix "ASCII::normalize_whitespace()" -> "CARRIAGE RETURN" is more like "
" and no "\n" +- add "ASCII::to_ascii_remap()" -> this method will return broken characters and is only for special cases + ### 1.5.6 (2020-11-12) - "ASCII::normalize_whitespace()" -> can now also remove "control characters" if needed v2 diff --git a/vendor/voku/portable-ascii/README.md b/vendor/voku/portable-ascii/README.md index 9dd7cecef..929c21e29 100644 --- a/vendor/voku/portable-ascii/README.md +++ b/vendor/voku/portable-ascii/README.md @@ -1,7 +1,7 @@ [//]: # (AUTO-GENERATED BY "PHP README Helper": base file -> docs/base.md) -[![Build Status](https://travis-ci.com/voku/portable-ascii.svg?branch=master)](https://travis-ci.com/voku/portable-ascii) +[![Build Status](https://github.com/voku/portable-ascii/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/voku/portable-ascii/actions) [![Build status](https://ci.appveyor.com/api/projects/status/gnejjnk7qplr7f5t/branch/master?svg=true)](https://ci.appveyor.com/project/voku/portable-ascii/branch/master) -[![Coverage Status](https://coveralls.io/repos/voku/portable-ascii/badge.svg?branch=master&service=github)](https://coveralls.io/github/voku/portable-ascii?branch=master) +[![codecov.io](https://codecov.io/github/voku/portable-ascii/coverage.svg?branch=master)](https://codecov.io/github/voku/portable-ascii?branch=master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/997c9bb10d1c4791967bdf2e42013e8e)](https://www.codacy.com/app/voku/portable-ascii) [![Latest Stable Version](https://poser.pugx.org/voku/portable-ascii/v/stable)](https://packagist.org/packages/voku/portable-ascii) [![Total Downloads](https://poser.pugx.org/voku/portable-ascii/downloads)](https://packagist.org/packages/voku/portable-ascii) @@ -96,8 +96,8 @@ The API from the "ASCII"-Class is written as small static methods. getAllLanguages is_ascii normalize_msword -normalize_whitespace -remove_invisible_characters +normalize_whitespace +remove_invisible_characters to_ascii to_filename to_slugify @@ -254,7 +254,7 @@ ASCII::normalize_msword('„Abcdef…”'); // '"Abcdef..."' -------- -#### normalize_whitespace(string $str, bool $keepNonBreakingSpace, bool $keepBidiUnicodeControls, bool $replaceSeparatorsWithNewline): string +#### normalize_whitespace(string $str, bool $keepNonBreakingSpace, bool $keepBidiUnicodeControls, bool $normalize_control_characters): string Normalize the whitespace. @@ -267,14 +267,14 @@ ASCII::normalize_whitespace("abc-\xc2\xa0-öäü-\xe2\x80\xaf-\xE2\x80\xAC", tru - `bool $keepNonBreakingSpace [optional]

Set to true, to keep non-breaking-spaces.

` - `bool $keepBidiUnicodeControls [optional]

Set to true, to keep non-printable (for the web) bidirectional text chars.

` -- `bool $replaceSeparatorsWithNewline [optional]

Set to true, to convert LINE and PARAGRAPH SEPARATOR with "\n".

` +- `bool $normalize_control_characters [optional]

Set to true, to convert e.g. LINE-, PARAGRAPH-SEPARATOR with "\n" and LINE TABULATION with "\t".

` **Return:** - `string

A string with normalized whitespace.

` -------- -#### remove_invisible_characters(string $str, bool $url_encoded, string $replacement, bool $keep_control_characters): string +#### remove_invisible_characters(string $str, bool $url_encoded, string $replacement, bool $keep_basic_control_characters): string Remove invisible characters from a string. @@ -286,7 +286,7 @@ copy&past from https://github.com/bcit-ci/CodeIgniter/blob/develop/system/core/C - `string $str` - `bool $url_encoded` - `string $replacement` -- `bool $keep_control_characters` +- `bool $keep_basic_control_characters` **Return:** - `string` diff --git a/vendor/voku/portable-ascii/build/docs/base.md b/vendor/voku/portable-ascii/build/docs/base.md index e21e73137..ca949d8b6 100644 --- a/vendor/voku/portable-ascii/build/docs/base.md +++ b/vendor/voku/portable-ascii/build/docs/base.md @@ -1,6 +1,6 @@ -[![Build Status](https://travis-ci.com/voku/portable-ascii.svg?branch=master)](https://travis-ci.com/voku/portable-ascii) +[![Build Status](https://github.com/voku/portable-ascii/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/voku/portable-ascii/actions) [![Build status](https://ci.appveyor.com/api/projects/status/gnejjnk7qplr7f5t/branch/master?svg=true)](https://ci.appveyor.com/project/voku/portable-ascii/branch/master) -[![Coverage Status](https://coveralls.io/repos/voku/portable-ascii/badge.svg?branch=master&service=github)](https://coveralls.io/github/voku/portable-ascii?branch=master) +[![codecov.io](https://codecov.io/github/voku/portable-ascii/coverage.svg?branch=master)](https://codecov.io/github/voku/portable-ascii?branch=master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/997c9bb10d1c4791967bdf2e42013e8e)](https://www.codacy.com/app/voku/portable-ascii) [![Latest Stable Version](https://poser.pugx.org/voku/portable-ascii/v/stable)](https://packagist.org/packages/voku/portable-ascii) [![Total Downloads](https://poser.pugx.org/voku/portable-ascii/downloads)](https://packagist.org/packages/voku/portable-ascii) diff --git a/vendor/voku/portable-ascii/src/voku/helper/ASCII.php b/vendor/voku/portable-ascii/src/voku/helper/ASCII.php index d4ec32ab1..aa676abda 100644 --- a/vendor/voku/portable-ascii/src/voku/helper/ASCII.php +++ b/vendor/voku/portable-ascii/src/voku/helper/ASCII.php @@ -200,7 +200,7 @@ final class ASCII * * @return string[] * - * @psalm-return array + * @phpstan-return array */ public static function getAllLanguages(): array { @@ -238,7 +238,7 @@ final class ASCII * * @return array * - * @psalm-return array> + * @phpstan-return array> */ public static function charsArray(bool $replace_extra_symbols = false): array { @@ -268,7 +268,7 @@ final class ASCII * @return array *

An array of replacements.

* - * @psalm-return array> + * @phpstan-return array> */ public static function charsArrayWithMultiLanguageValues(bool $replace_extra_symbols = false): array { @@ -300,10 +300,7 @@ final class ASCII $CHARS_ARRAY[$cacheKey] = $return; - /** @noinspection PhpSillyAssignmentInspection - hack for phpstan */ - /** @var array> $return */ - $return = $return; - + /** @var array> $return - hack for phpstan */ return $return; } @@ -332,7 +329,7 @@ final class ASCII * @return array *

An array of replacements.

* - * @psalm-return array{orig: string[], replace: string[]}|array + * @phpstan-return array{orig: string[], replace: string[]}|array */ public static function charsArrayWithOneLanguage( string $language = self::ENGLISH_LANGUAGE_CODE, @@ -428,7 +425,7 @@ final class ASCII * @return array *

An array of replacements.

* - * @psalm-return array{orig: string[], replace: string[]}|array + * @phpstan-return array{orig: string[], replace: string[]}|array */ public static function charsArrayWithSingleLanguageValues( bool $replace_extra_symbols = false, @@ -616,7 +613,7 @@ final class ASCII * @param bool $keepNonBreakingSpace [optional]

Set to true, to keep non-breaking-spaces.

* @param bool $keepBidiUnicodeControls [optional]

Set to true, to keep non-printable (for the web) * bidirectional text chars.

- * @param bool $normalize_control_characters [optional]

Set to true, to convert LINE-, PARAGRAPH-SEPARATOR with "\n" and LINE TABULATION with "\t".

+ * @param bool $normalize_control_characters [optional]

Set to true, to convert e.g. LINE-, PARAGRAPH-SEPARATOR with "\n" and LINE TABULATION with "\t".

* * @psalm-pure * @@ -645,16 +642,14 @@ final class ASCII "\x0d\x0c", // 'END OF LINE' "\xe2\x80\xa8", // 'LINE SEPARATOR' "\xe2\x80\xa9", // 'PARAGRAPH SEPARATOR' - "\x0c", // 'FORM FEED' - "\x0d", // 'CARRIAGE RETURN' - "\x0b", // 'VERTICAL TAB' + "\x0c", // 'FORM FEED' // "\f" + "\x0b", // 'VERTICAL TAB' // "\v" ], [ "\n", "\n", "\n", "\n", - "\n", "\t", ], $str @@ -737,6 +732,71 @@ final class ASCII return $str; } + /** + * WARNING: This method will return broken characters and is only for special cases. + * + * Convert two UTF-8 encoded string to a single-byte strings suitable for + * functions that need the same string length after the conversion. + * + * The function simply uses (and updates) a tailored dynamic encoding + * (in/out map parameter) where non-ascii characters are remapped to + * the range [128-255] in order of appearance. + * + * @param string $str1 + * @param string $str2 + * + * @return string[] + * + * @phpstan-return array{0: string, 1: string} + */ + public static function to_ascii_remap(string $str1, string $str2): array + { + $charMap = []; + $str1 = self::to_ascii_remap_intern($str1, $charMap); + $str2 = self::to_ascii_remap_intern($str2, $charMap); + + return [$str1, $str2]; + } + + /** + * WARNING: This method will return broken characters and is only for special cases. + * + * Convert a UTF-8 encoded string to a single-byte string suitable for + * functions that need the same string length after the conversion. + * + * The function simply uses (and updates) a tailored dynamic encoding + * (in/out map parameter) where non-ascii characters are remapped to + * the range [128-255] in order of appearance. + * + * Thus, it supports up to 128 different multibyte code points max over + * the whole set of strings sharing this encoding. + * + * Source: https://github.com/KEINOS/mb_levenshtein + * + * @param string $str UTF-8 string to be converted to extended ASCII. + * @return string Mapped borken string. + */ + private static function to_ascii_remap_intern(string $str, array &$map): string + { + // find all utf-8 characters + $matches = []; + if (!\preg_match_all('/[\xC0-\xF7][\x80-\xBF]+/', $str, $matches)) { + return $str; // plain ascii string + } + + // update the encoding map with the characters not already met + $mapCount = \count($map); + foreach ($matches[0] as $mbc) { + if (!isset($map[$mbc])) { + $map[$mbc] = \chr(128 + $mapCount); + $mapCount++; + } + } + + // finally remap non-ascii characters + return \strtr($str, $map); + } + /** * Returns an ASCII version of the string. A set of non-ASCII characters are * replaced with their closest ASCII counterparts, and the rest are removed @@ -807,7 +867,7 @@ final class ASCII $EXTRA_SYMBOLS_CACHE === null ) { $EXTRA_SYMBOLS_CACHE = []; - foreach (self::$ASCII_EXTRAS ?? [] as $extrasLanguageTmp => $extrasDataTmp) { + foreach (self::$ASCII_EXTRAS ?? [] as $extrasDataTmp) { foreach ($extrasDataTmp as $extrasDataKeyTmp => $extrasDataValueTmp) { $EXTRA_SYMBOLS_CACHE[$extrasDataKeyTmp] = $extrasDataKeyTmp; } @@ -933,7 +993,7 @@ final class ASCII } } - foreach ($matches[0] as $keyTmp => $char) { + foreach ($matches[0] as $char) { if ( !isset($charDone[$char]) && -- cgit v1.2.3