Completed
Push — master ( 0a0c5c...27f4d6 )
by Lars
16:42 queued 05:24
created

file_functions.php ➔ fht_deltree()   B

Complexity

Conditions 5
Paths 4

Size

Total Lines 15
Code Lines 9

Duplication

Lines 15
Ratio 100 %

Importance

Changes 0
Metric Value
cc 5
eloc 9
nc 4
nop 1
dl 15
loc 15
rs 8.8571
c 0
b 0
f 0
1
<?php
2 View Code Duplication
function fht_deltree($f)
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3
{
4
5
    if (is_dir($f)) {
6
        foreach (scandir($f) as $item) {
7
            if (!strcmp($item, '.') || !strcmp($item, '..')) {
8
                continue;
9
            }
10
            fht_deltree($f . "/" . $item);
11
        }
12
        rmdir($f);
13
    } else{
14
        @unlink($f);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
15
    }
16
}
17
18
19 View Code Duplication
function iht_deltree($f)
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
{
21
22
    if (is_dir($f)) {
23
        foreach (scandir($f) as $item) {
24
            if (!strcmp($item, '.') || !strcmp($item, '..')) {
25
                continue;
26
            }
27
            iht_deltree($f . "/" . $item);
28
        }
29
        rmdir($f);
30
    } else{
31
        @unlink($f);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
32
    }
33
}
34