Empties::notEmptyBoth()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of the "andrey-helldar/support" project.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author Andrey Helldar <[email protected]>
9
 *
10
 * @copyright 2021 Andrey Helldar
11
 *
12
 * @license MIT
13
 *
14
 * @see https://github.com/andrey-helldar/support
15
 */
16
17
namespace Helldar\Support\Callbacks;
18
19
class Empties
20
{
21 25
    public function notEmpty(): callable
22
    {
23 25
        return static function ($value) {
24 25
            return ! empty($value);
25 25
        };
26
    }
27
28 2
    public function notEmptyBoth(): callable
29
    {
30 2
        return static function ($value, $key) {
31 2
            return ! empty($value) && ! empty($key);
32 2
        };
33
    }
34
}
35