CollectionManager::collectionContains()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 9.4285
cc 3
eloc 5
nc 3
nop 2
crap 3
1
<?php
2
3
namespace Accessible\MethodManager;
4
5
class CollectionManager extends MethodCallManager
6
{
7
    /**
8
     * Indicates wether given collection contains the wanted item or not.
9
     *
10
     * @param  mixed $needle
11
     * @param  array $haystack
12
     *
13
     * @return bool
14
     */
15 3
    public static function collectionContains($needle, $haystack)
16
    {
17 3
        foreach ($haystack as $value) {
18 3
            if ($value === $needle) {
19 3
                return true;
20
            }
21 3
        }
22
23 3
        return false;
24
    }
25
}
26