some()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace BrenoRoosevelt;
5
6
/**
7
 * Evaluates if some matches the specification
8
 *
9
 * @param iterable $items The collection
10
 * @param callable $callback Callable must return a boolean
11
 * @param int $mode [optional] <p>
12
 * Flag determining what arguments are sent to <i>callback</i>:
13
 * </p><ul>
14
 * <li>
15
 * <b>CALLBACK_USE_VALUE</b> - <b>default</b> pass value as the only argument
16
 * </li>
17
 * <li>
18
 * <b>CALLBACK_USE_KEY</b> - pass key as the only argument
19
 * to <i>callback</i> instead of the value</span>
20
 * </li>
21
 * <li>
22
 * <b>CALLBACK_USE_BOTH</b> - pass both value and key as
23
 * arguments to <i>callback</i></span>
24
 * </li>
25
 * </ul>
26
 * @return bool
27
 */
28
function some(iterable $items, callable $callback, int $mode = CALLBACK_USE_VALUE): bool
29
{
30
    return at_least(1, $items, $callback, $mode);
31
}
32