Passed
Push — master ( df9f47...bd3ab4 )
by Yaroslav
01:28
created

StrHelper::implodeFiltered()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 1
nop 3
crap 2
1
<?php
2
3
namespace Angecode\LaravelFullName;
4
5
class StrHelper
6
{
7 3
    public static function implodeFiltered(array $items, string $glue = ' ', callable $callback = null)
8
    {
9 3
        return implode(
10 3
            $glue,
11 3
            ($callback) ? array_filter($items, $callback) : array_filter($items)
12
        );
13
    }
14
}
15