From 574d024c250972b1aa3845c9c99729309d069f05 Mon Sep 17 00:00:00 2001 From: Saturnin Wanonkou Date: Fri, 10 Jan 2025 07:44:09 +0100 Subject: [PATCH 1/5] fix: argument passing --- composer.json | 4 ++-- src/JCrowe/BadWordFilter/BadWordFilter.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 5cb734c..8a24f7f 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ } ], "require": { - "php": ">=5.3.0", + "php": "8.*", "illuminate/support": ">=4.0.0" }, "require-dev": { @@ -26,4 +26,4 @@ } }, "minimum-stability": "stable" -} \ No newline at end of file +} diff --git a/src/JCrowe/BadWordFilter/BadWordFilter.php b/src/JCrowe/BadWordFilter/BadWordFilter.php index 724f472..9f21a2e 100644 --- a/src/JCrowe/BadWordFilter/BadWordFilter.php +++ b/src/JCrowe/BadWordFilter/BadWordFilter.php @@ -247,7 +247,7 @@ private function findBadWordsInArray(array $input = [], $previousKey = false) * * @return mixed */ - private function cleanArray(array $array = [], $replaceWith) + private function cleanArray(array $array, $replaceWith) { $dirtyKeys = $this->findBadWordsInArray($array); From f155c3954a7773bab01b67effd2a73d6298f1229 Mon Sep 17 00:00:00 2001 From: Saturnin Wanonkou Date: Fri, 10 Jan 2025 07:55:58 +0100 Subject: [PATCH 2/5] fix: package name --- composer.json | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 8a24f7f..91e70f7 100644 --- a/composer.json +++ b/composer.json @@ -1,11 +1,11 @@ { - "name": "jcrowe/bad-word-filter", + "name": "satnin/bad-word-filter", "description": "PHP Bad word filtering. Checks for the existence of a bad word in a string or array.", "license": "MIT", "authors": [ { - "name": "Jonathan Crowe", - "email": "jcrowe206@gmail.com" + "name": "Saturnin Wanonkou", + "email": "saturninwanonkou17@gmail.com" } ], "require": { @@ -25,5 +25,10 @@ "JCrowe\\BadWordFilter\\": "src/" } }, - "minimum-stability": "stable" + "minimum-stability": "stable", + "config": { + "allow-plugins": { + "kylekatarnls/update-helper": true + } + } } From 519fb8fac0d3b582c118d8f975689a5bb228c26f Mon Sep 17 00:00:00 2001 From: Saturnin Wanonkou Date: Fri, 10 Jan 2025 10:09:12 +0100 Subject: [PATCH 3/5] fix: flatten array --- src/JCrowe/BadWordFilter/BadWordFilter.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/JCrowe/BadWordFilter/BadWordFilter.php b/src/JCrowe/BadWordFilter/BadWordFilter.php index 9f21a2e..b472e84 100644 --- a/src/JCrowe/BadWordFilter/BadWordFilter.php +++ b/src/JCrowe/BadWordFilter/BadWordFilter.php @@ -515,14 +515,8 @@ private function getBadWordsFromDB() */ private function flattenArray($array) { - $objTmp = (object)['aFlat' => []]; - - $callBack = function(&$v, $k, &$t) { - $t->aFlat[] = $v; - }; - - array_walk_recursive($array, $callBack, $objTmp); - + $objTmp = (object)['aFlat' => []]; + array_walk_recursive($array, function($v) use (&$objTmp){$objTmp->aFlat[] = $v;}); return $objTmp->aFlat; } @@ -548,4 +542,4 @@ private function hasAlternateSourceFile(array $options) return !empty($options['source_file']) && $options['source_file'] !== $this->defaults['source_file']; } -} +} \ No newline at end of file From 57ef54ac703807294181d401aeb2a2a0ec21bd4a Mon Sep 17 00:00:00 2001 From: Saturnin Wanonkou Date: Sat, 11 Jan 2025 12:30:05 +0100 Subject: [PATCH 4/5] fix: restore package name --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 91e70f7..952fe10 100644 --- a/composer.json +++ b/composer.json @@ -4,8 +4,8 @@ "license": "MIT", "authors": [ { - "name": "Saturnin Wanonkou", - "email": "saturninwanonkou17@gmail.com" + "name": "Jonathan Crowe", + "email": "jcrowe206@gmail.com" } ], "require": { From 68a69afa0668ae4d419f4bfe83efa4d955857320 Mon Sep 17 00:00:00 2001 From: Saturnin Wanonkou Date: Sat, 11 Jan 2025 12:31:22 +0100 Subject: [PATCH 5/5] fix: restore package name --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 952fe10..7f38e29 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "satnin/bad-word-filter", + "name": "jcrowe/bad-word-filter", "description": "PHP Bad word filtering. Checks for the existence of a bad word in a string or array.", "license": "MIT", "authors": [