Unfolder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 33
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A with() 0 4 1
1
<?php
2
/******************************************************************************
3
 * An iterator interface over the Leagues flysystem.
4
 * Copyright (c) 2021, 2015 Richard Klees <[email protected]>
5
 *
6
 * This software is licensed under GPLv3. You should have received
7
 * a copy of the along with the code.
8
 */
9
10
namespace Lechimp\Flightcontrol;
11
12
/**
13
* This object can unfold a directory structure into an directory.
14
*/
15
class Unfolder
16
{
17
    /**
18
     * @var Directory
19
     */
20
    protected $directory;
21
22
    /**
23
     * @var mixed
24
     */
25
    protected $start_value;
26
27
    /**
28
     * @param mixed $start_value
29
     */
30 5
    public function __construct(Directory $directory, $start_value)
31
    {
32 5
        $this->directory = $directory;
33 5
        $this->start_value = $start_value;
34 5
    }
35
36
    /**
37
     * Define the function to unfold the directory structure and perform
38
     * the unfold operation.
39
     *
40
     * @param   \Closure    $unfolder  a -> File|FDirectory a -> a
41
     * @throws  \LogicException         When generated root node is a file.
42
     */
43 5
    public function with(\Closure $unfolder) : void
44
    {
45 5
        $this->directory->insertByAna($unfolder, $this->start_value);
46 4
    }
47
}
48