CollectionKeyAccessorTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 2
Metric Value
c 3
b 0
f 2
dl 0
loc 20
wmc 2
lcom 0
cbo 0
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A search() 0 4 1
A keys() 0 4 1
1
<?php
2
namespace TRex\Collection;
3
4
trait CollectionKeyAccessorTrait
5
{
6
    /**
7
     * @param mixed $value
8
     * @param bool $isStrict
9
     * @return array
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use array<integer|string>.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
10
     */
11 2
    public function search($value, $isStrict = true)
12
    {
13 2
        return array_keys((array)$this, $value, $isStrict);
14
    }
15
16
    /**
17
     * @return array
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use array<integer|string>.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
18
     */
19 3
    public function keys()
20
    {
21 3
        return array_keys((array)$this);
22
    }
23
}