FileUtils::addLine()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
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