Completed
Push — master ( 29472a...0fa5c2 )
by Richan
04:47 queued 03:37
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\Audit\Concerns;
4
5
trait SanitizeInput
6
{
7
    /**
8
     * Trim double quotes from input options.
9
     *
10
     * @param string $text
11
     * @return string
12
     */
13
    protected function trimDoubleQuotes(string $text) :string
14
    {
15
        return ((strpos($text, '"') === 0) && ($text[strlen($text)-1] === '"')) ?
16
            substr($text, 1, -1) :
17
            $text;
18
    }
19
}
20