Info   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getFileName() 0 3 1
A getDirName() 0 3 1
A getBaseName() 0 3 1
A __construct() 0 3 1
A getExtension() 0 3 1
1
<?php
2
declare(strict_types=1);
3
/**
4
 * Infrastructure Related Agent
5
 * @author Max Demian <[email protected]>
6
 */
7
8
namespace Ticaje\FileManager\Infrastructure\Driver\Reader\File;
9
10
use Ticaje\FileManager\Infrastructure\Driver\Reader\Interfaces\FileInfoInterface;
11
12
/**
13
 * Class Info
14
 * @package Ticaje\FileManager\Infrastructure\Driver\Reader\File
15
 */
16
class Info implements FileInfoInterface
17
{
18
    /** @var mixed $fileInfo */
19
    private $fileInfo;
20
21
    /**
22
     * Info constructor.
23
     *
24
     * @param string $fileName
25
     */
26
    public function __construct(string $fileName)
27
    {
28
        $this->fileInfo = pathinfo($fileName);
29
    }
30
31
    /**
32
     * @inheritDoc
33
     */
34
    public function getBaseName(): string
35
    {
36
        return $this->fileInfo['basename'];
37
    }
38
39
    /**
40
     * @inheritDoc
41
     */
42
    public function getDirName(): string
43
    {
44
        return $this->fileInfo['dirname'];
45
    }
46
47
    /**
48
     * @inheritDoc
49
     */
50
    public function getExtension(): string
51
    {
52
        return $this->fileInfo['extension'];
53
    }
54
55
    /**
56
     * @inheritDoc
57
     */
58
    public function getFileName(): string
59
    {
60
        return $this->fileInfo['filename'];
61
    }
62
}
63