Passed
Push — master ( a2d8fe...d7eb30 )
by Ben
04:30
created

SanitizeParameters::rawurlencode()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 1
nop 1
dl 0
loc 9
ccs 4
cts 4
cp 1
crap 2
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
namespace Thinktomorrow\Locale\Parsers;
4
5
class SanitizeParameters
6
{
7
    /**
8
     * Loop over the parameters and make sure they are properly url encoded
9
     *
10
     * @param array  $parameters
11
     * @return array
12
     */
13 29
    public static function rawurlencode(array $parameters): array
14
    {
15
        return array_map(function($param){
16
            // Null values are kept as is, so they'll get properly removed.
17 18
            if(null === $param) return $param;
18
19 18
            return rawurlencode($param);
20 29
        }, $parameters);
21
    }
22
}
23