FilesystemUtils   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 42
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createPath() 0 3 1
A listDirectory() 0 3 1
A createSymlink() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rico\Lib;
6
7
use Rico\Slib\FilesystemUtils as StaticFilesytemUtils;
8
9
class FilesystemUtils
10
{
11
    const LIST_DIRECTORY_FILE_ONLY = 1;
12
    const LIST_DIRECTORY_DIR_ONLY = 2;
13
    const LIST_DIRECTORY_BOTH = 3;
14
15
    /**
16
     * Creates the completer $path with all missing intermediates directories.
17
     *
18
     * @param string $path
19
     *
20
     * @return bool
21
     */
22
    public function createPath(string $path): bool
23
    {
24
        return StaticFilesytemUtils::createPath($path);
25
    }
26
27
    /**
28
     * Creates a symbolic $link pointing to $file.
29
     *
30
     * @param string $link
31
     * @param string $file
32
     *
33
     * @return bool
34
     */
35
    public function createSymlink(string $link, string $file): bool
36
    {
37
        return StaticFilesytemUtils::createSymlink($link, $file);
38
    }
39
40
    /**
41
     * Gets filenames and folders names (according to $option) inside a $path.
42
     *
43
     * @param string $path
44
     * @param int    $option
45
     *
46
     * @return string[]
47
     */
48
    public function listDirectory(string $path, int $option = self::LIST_DIRECTORY_BOTH): ?array
49
    {
50
        return StaticFilesytemUtils::listDirectory($path, $option);
51
    }
52
}
53