ArrayTrait::arrayOnly()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php namespace ivuorinen\BBCode\Traits;
2
3
trait ArrayTrait
4
{
5
    /**
6
     * Filters all parsers that you don´t want
7
     * @param array $parsers An array of all parsers
8
     * @param array $only Chosen parsers
9
     * @return array parsers
10
     */
11 1
    private function arrayOnly(array $parsers, $only)
12
    {
13 1
        return array_intersect_key($parsers, array_flip((array)$only));
14
    }
15
16
    /**
17
     * Removes the parsers that you don´t want
18
     * @param array $parsers An array of all parsers
19
     * @param array $except Parsers to exclude
20
     * @return array parsers
21
     */
22 2
    private function arrayExcept(array $parsers, $except)
23
    {
24 2
        return array_diff_key($parsers, array_flip((array)$except));
25
    }
26
}
27