FileGetContents::__invoke()   B
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 24
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 8.9713
c 0
b 0
f 0
cc 2
eloc 18
nc 2
nop 5
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Marcosh\Effector\Effect\File;
6
7
final class FileGetContents
8
{
9
    /**
10
     * @param string $fileName
11
     * @return string|bool may return false on failure
12
     */
13
    public function __invoke(
14
        string $fileName,
15
        ?bool $useIncludePath = false,
16
        ?resource $context = null,
17
        int $offset = 0,
18
        ?int $maxLength = null
19
    ) {
20
        if (null === $maxLength) {
21
            return file_get_contents(
22
                $fileName,
23
                $useIncludePath,
24
                $context,
25
                $offset
26
            );
27
        }
28
29
        return file_get_contents(
30
            $fileName,
31
            $useIncludePath,
32
            $context,
33
            $offset,
34
            $maxLength
35
        );
36
    }
37
}
38