StringHelper   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 4
c 1
b 0
f 0
dl 0
loc 13
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A sanitize() 0 5 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
}