Passed
Push — master ( 4f6f8e...2905b8 )
by Cesar
01:59
created

AbstractProcessor::removeExtension()   A

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
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Cesargb\Log\Processors;
4
5
abstract class AbstractProcessor
6
{
7
    protected string $filenameSource;
8
9
    protected string $extension = '';
10
11
    abstract public function handler(string $filename): ?string;
12
13
    public function __construct()
14
    {
15
        clearstatcache();
16
    }
17
18
    public function addExtension(string $extension): void
19
    {
20
        $this->extension = '.'.$extension;
21
    }
22
23
    public function removeExtension(string $extension): void
24
    {
25
        $this->extension = str_replace('.'.$extension, '', $this->extension);
26
    }
27
28
    public function setFilenameSource(string $filenameSource): self
29
    {
30
        $this->filenameSource = $filenameSource;
31
32
        return $this;
33
    }
34
35
    protected function processed(string $filename): ?string
36
    {
37
        return is_file($filename) ? $filename : null;
38
    }
39
}
40