FileList   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 22
c 1
b 0
f 1
dl 0
loc 76
rs 10
wmc 8

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getXmlFileList() 0 3 1
A getPhpFileList() 0 3 1
A getTemplates() 0 3 1
A getComposerFile() 0 3 1
A addEntry() 0 18 4
1
<?php
2
3
4
namespace MagentoHackathon\Model;
5
6
use Symfony\Component\Finder\SplFileInfo;
7
8
/**
9
 * Model for different file type list.
10
 */
11
class FileList
12
{
13
    /**
14
     * @var array
15
     */
16
    private $templates = [];
17
18
    /**
19
     * @var array
20
     */
21
    private $phpFileList = [];
22
23
    /**
24
     * @var array
25
     */
26
    private $xmlFileList = [];
27
28
    /**
29
     * @var string
30
     */
31
    private $composerFile = '';
32
33
    /**
34
     * @param SplFileInfo $file
35
     */
36
    public function addEntry(SplFileInfo $file)
37
    {
38
        switch ($file->getExtension()) {
39
            case 'php':
40
                $this->phpFileList[] = $file;
41
                break;
42
43
            case 'json':
44
                $this->composerFile = $file;
45
                break;
46
47
            case 'xml':
48
                $this->xmlFileList[] = $file;
49
                break;
50
51
            default:
52
                $this->templates[] = $file;
53
                break;
54
        }
55
    }
56
57
    /**
58
     * @return SplFileInfo[] | array
59
     */
60
    public function getPhpFileList(): array
61
    {
62
        return $this->phpFileList;
63
    }
64
65
    /**
66
     * @return string
67
     */
68
    public function getComposerFile(): string
69
    {
70
        return $this->composerFile;
71
    }
72
73
    /**
74
     * @return SplFileInfo[] | array
75
     */
76
    public function getTemplates(): array
77
    {
78
        return $this->templates;
79
    }
80
81
    /**
82
     * @return SplFileInfo[] | array
83
     */
84
    public function getXmlFileList(): array
85
    {
86
        return $this->xmlFileList;
87
    }
88
}
89