Completed
Push — master ( 8f1053...c250e4 )
by Antonio
13:19
created

RecipientsHelper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 16
rs 10

1 Method

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