Passed
Pull Request — master (#4)
by Nicolas
09:45
created

Includes   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 15
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
     * @return bool
18
     */
19
    public function includes($needle, array $options = []): bool
20
    {
21
        if (!empty($options['strict'])) {
22
            return in_array($needle, $this->array, $options['strict']);
23
        } else {
24
            return in_array($needle, $this->array);
25
        }
26
    }
27
}
28