ArrayDepth   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 14
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1
ccs 0
cts 9
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A toDepth() 0 11 1
1
<?php
2
3
namespace BestServedCold\PhalueObjects\VOClosure;
4
5
use BestServedCold\PhalueObjects\VOClosure;
6
7
/**
8
 * Class Depth
9
 *
10
 * @package BestServedCold\PhalueObjects\VOClosure
11
 */
12
class ArrayDepth extends VOClosure
13
{
14
    public static function toDepth()
15
    {
16
        return new static(
17
            function (&$max) {
18
                return function ($line) use (&$max) {
19
                    // every line-indent equals 4 spaces
20
                    $max = max([$max, (strlen($line) - strlen(ltrim($line))) / 4]);
21
                };
22
            }
23
        );
24
    }
25
}
26