Vcsignore   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 6
Bugs 2 Features 2
Metric Value
wmc 5
eloc 22
c 6
b 2
f 2
dl 0
loc 36
ccs 0
cts 13
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 4 1
A load() 0 12 4
1
<?php
2
/**
3
 * Automation tool mixed with code generator for easier continuous development
4
 *
5
 * @link      https://github.com/hiqdev/hidev
6
 * @package   hidev
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hidev\components;
12
13
/**
14
 * VCS ignore component.
15
 */
16
class Vcsignore extends File
17
{
18
    protected $_items = [
19
        '/.env'                     => 'local config',
20
        '.*.swp'                    => 'IDE & OS files',
21
        '.idea'                     => 'IDE & OS files',
22
        'nbproject'                 => 'IDE & OS files',
23
        '.buildpath'                => 'IDE & OS files',
24
        '.project'                  => 'IDE & OS files',
25
        '.settings'                 => 'IDE & OS files',
26
        'Thumbs.db'                 => 'IDE & OS files',
27
        '.DS_Store'                 => 'IDE & OS files',
28
        '/lsp'                      => 'IDE & OS files',
29
    ];
30
31
    public function init()
32
    {
33
        $this->_path = $this->take('vcs')->ignorefile;
34
        $this->load();
35
    }
36
37
    /**
38
     * Load.
39
     */
40
    public function load()
41
    {
42
        $items = [];
43
        foreach ($this->take('binaries')->getItems() as $binary) {
44
            if ($vcsignore = $binary->getVcsignore()) {
45
                $items[$vcsignore] = 'Binaries';
46
            }
47
        }
48
        unset($items['git.phar']);
49
        $this->setItems($items);
50
        $items = $this->getFile()->load() ?: [];
51
        $this->setItems($items);
52
    }
53
}
54