Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
isszz committed Jul 31, 2023
1 parent 23a744b commit 30a56fc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ return [

'config' => [
'repeat' => true, // 重复替换为敏感词相同长度的字符
'replaceChar' => '*', // 替换字符
'replace_char' => '*', // 替换字符
// 标记敏感词,标签生成<mark>敏感词</mark>
'mark' => 'mark',
],
Expand Down Expand Up @@ -101,7 +101,7 @@ class Index
}

```
依赖注入方式,推荐
依赖注入方式
```php
use isszz\sensitive\Sensitive;

Expand Down
4 changes: 1 addition & 3 deletions src/Sensitive.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,7 @@ public function replace(string $content, string $replaceChar = '', bool $repeat
throw new SensitiveException('Please fill in the content of the test', 1);
}

if(!$replaceChar) {
$replaceChar = $this->config['replaceChar'] ?? '';
}
$replaceChar = $replaceChar ?: $this->config['replace_char'];

if(!$repeat) {
$repeat = $this->config['repeat'] ?? false;
Expand Down
2 changes: 1 addition & 1 deletion src/config/plugin/isszz/webman-sensitive/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'mode' => 'file',
'config' => [
'repeat' => true, // 重复替换为敏感词相同长度的字符
'replaceChar' => '*', // 替换字符
'replace_char' => '*', // 替换字符
// 标记敏感词,标签生成<mark>敏感词</mark>
'mark' => 'mark',
],
Expand Down

0 comments on commit 30a56fc

Please sign in to comment.