IsAssoc   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 5
c 1
b 1
f 0
dl 0
loc 18
ccs 5
cts 5
cp 1
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A isAssoc() 0 9 3
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of Wszetko Sitemap.
7
 *
8
 * (c) Paweł Kłopotek-Główczewski <[email protected]>
9
 *
10
 * This source file is subject to the MIT license that is bundled
11
 * with this source code in the file LICENSE.
12
 */
13
14
namespace Wszetko\Sitemap\Traits;
15
16
/**
17
 * Trait IsAssoc
18
 *
19
 * @package Wszetko\Sitemap\Traits
20
 */
21
trait IsAssoc
22
{
23
    /**
24
     * Check if array is associative.
25
     *
26
     * @param array $array
27
     *
28
     * @return bool
29
     */
30 4
    protected function isAssoc(array $array): bool
31
    {
32 4
        foreach (array_keys($array) as $key) {
33 4
            if (!is_integer($key)) {
34 4
                return true;
35
            }
36
        }
37
38 4
        return false;
39
    }
40
}
41