Passed
Push — master ( 5152d0...005a62 )
by Florian
03:23 queued 01:27
created

Includes   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 16
ccs 4
cts 4
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A includes() 0 6 2
1
<?php
2
3
namespace Cocur\Chain\Link;
4
5
/**
6
 * Includes.
7
 *
8
 * @author    Nicolas Reynis
9
 */
10
trait Includes
11
{
12
    /**
13
     * Returns `true` if the given `needle` is in the array or `false` otherwise.
14
     *
15
     * @param $needle
16
     * @param array $options options, including `strict` to also check the type
17
     *
18
     * @return bool
19
     */
20 2
    public function includes($needle, array $options = []): bool
21
    {
22 2
        if (!empty($options['strict'])) {
23 1
            return in_array($needle, $this->array, $options['strict']);
24
        } else {
25 1
            return in_array($needle, $this->array);
26
        }
27
    }
28
}
29