Completed
Push — master ( da521e...2646ae )
by Richan
01:12
created

SanitizeInput::trimDoubleQuotes()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 3
nc 4
nop 1
1
<?php
2
3
namespace Suitmedia\LighthouseAudit\Concerns;
4
5
trait SanitizeInput
6
{
7
    /**
8
     * Trim double quotes from input options.
9
     *
10
     * @param string $text
11
     *
12
     * @return string
13
     */
14
    protected function trimDoubleQuotes(string $text) :string
15
    {
16
        return ((strpos($text, '"') === 0) && ($text[strlen($text) - 1] === '"')) ?
17
            substr($text, 1, -1) :
18
            $text;
19
    }
20
}
21