Passed
Push — master ( 45207e...ca5789 )
by Josh
14:32
created

HasValidActions::toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace JoshGaber\NovaUnit\Constraints;
4
5
use Laravel\Nova\Actions\Action;
6
use PHPUnit\Framework\Constraint\Constraint;
7
8
class HasValidActions extends Constraint
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13 2
    public function toString(): string
14
    {
15 2
        return 'contains valid actions only';
16
    }
17
18 3
    public function matches($other): bool
19
    {
20 3
        if (! \is_array($other)) {
21 1
            return false;
22
        }
23
24 2
        foreach ($other as $action) {
25 2
            if (! $action instanceof Action) {
26 2
                return false;
27
            }
28
        }
29
30 1
        return true;
31
    }
32
}
33