ArrayTrait::arrayExcept()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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