FileUtils   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addLine() 0 3 1
A count() 0 3 1
A extractExtension() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rico\Lib;
6
7
use Rico\Slib\FileUtils as StaticFileUtils;
8
9
class FileUtils
10
{
11
    /**
12
     * Adds a new $line at the end of a $file without duplication.
13
     *
14
     * @param string $file
15
     * @param string $line
16
     *
17
     * @return bool|null
18
     */
19
    public function addLine(string $file, string $line)
20
    {
21
        return StaticFileUtils::addLine($file, $line);
22
    }
23
24
    /**
25
     * Counts the number of lines in a $file.
26
     *
27
     * @param string $file
28
     * @param bool   $countEmpty
29
     *
30
     * @return int|bool
31
     */
32
    public function count(string $file, bool $countEmpty = false)
33
    {
34
        return StaticFileUtils::count($file, $countEmpty);
35
    }
36
37
    /**
38
     * Extracts the extension (without the dot) of a filename alone or contained in a path.
39
     *
40
     * @param string $filename
41
     *
42
     * @return string
43
     */
44
    public function extractExtension(string $filename): string
45
    {
46
        return StaticFileUtils::extractExtension($filename);
47
    }
48
}
49