ArrayTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 2
c 2
b 1
f 0
lcom 0
cbo 0
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A arrayOnly() 0 4 1
A arrayExcept() 0 4 1
1
<?php namespace Golonka\BBCode\Traits;
2
3
trait ArrayTrait
4
{
5
6
    /**
7
     * Filters all parsers that you don´t want
8
     * @param array $parsers An array of all parsers
9
     * @param array $only Chosen parsers
10
     * @return array parsers
11
     */
12
    private function arrayOnly(array $parsers, $only)
13
    {
14
        return array_intersect_key($parsers, array_flip((array) $only));
15
    }
16
17
    /**
18
     * Removes the parsers that you don´t want
19
     * @param array $parsers An array of all parsers
20
     * @param array $except Parsers to exclude
21
     * @return array parsers
22
     */
23
    private function arrayExcept(array $parsers, $except)
24
    {
25
        return array_diff_key($parsers, array_flip((array) $except));
26
    }
27
}
28