StringHelper::sanitize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Squareetlabs\VeriFactu\Helpers;
6
7
class StringHelper
8
{
9
    /**
10
     * Sanitizes a string by trimming whitespace and replacing '&' and '<' characters.
11
     *
12
     * @param string $inputString The string to sanitize.
13
     * @return string The sanitized string.
14
     */
15
    public static function sanitize(string $inputString): string
16
    {
17
        $trimmedString = trim($inputString);
18
        $sanitizedString = str_replace(['&', '<'], ['&amp;', '&lt;'], $trimmedString);
19
        return $sanitizedString;
20
    }
21
}