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

SanitizeParameters   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A rawurlencode() 0 9 2
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