RecipientsHelper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 14
ccs 4
cts 4
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A sanitize() 0 5 2
1
<?php
2
3
namespace Da\Mailer\Helper;
4
5
class RecipientsHelper
6
{
7
    /**
8
     * Trims recipients. If string, will split into array based on commas or semicolons delimiters.
9
     *
10
     * @param string|array $recipients
11
     *
12
     * @return array
13 4
     */
14
    public static function sanitize($recipients)
15 4
    {
16 4
        return is_string($recipients)
17 4
            ? array_filter(array_map('trim', preg_split('/(,|;)/', $recipients)))
18
            : array_filter(array_map('trim', (array) $recipients));
19
    }
20
}
21