ArrayTypeHint::match()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 4
nc 4
nop 1
1
<?php
2
/**
3
 * This file is part of Properties package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Serafim\Properties\Attribute;
11
12
/**
13
 * Class ArrayTypeHint
14
 */
15
class ArrayTypeHint extends TypeHint
16
{
17
    /**
18
     * @param iterable|mixed $values
19
     * @return bool
20
     */
21
    public function match($values): bool
22
    {
23
        if (! \is_iterable($values)) {
24
            return false;
25
        }
26
27
        foreach ($values as $value) {
28
            if (! parent::match($value)) {
29
                return false;
30
            }
31
        }
32
33
        return true;
34
    }
35
}
36