Skip to content

Commit 2b763d1

Browse files
author
Andrey Helldar
committed
Optimized replacing notifications
1 parent 295d9f0 commit 2b763d1

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/Support/Information.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Helldar\LaravelActions\Support;
44

5-
use Illuminate\Support\Str;
6-
75
final class Information
86
{
97
protected $available = [
@@ -18,12 +16,10 @@ final class Information
1816

1917
public function replace(string $value): string
2018
{
21-
foreach ($this->available as $search => $replace) {
22-
if (Str::contains($value, $search)) {
23-
return str_replace($search, $replace, $value);
24-
}
25-
}
26-
27-
return $value;
19+
return str_replace(
20+
array_keys($this->available),
21+
array_values($this->available),
22+
$value
23+
);
2824
}
2925
}

0 commit comments

Comments
 (0)