FileBuilder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildFile() 0 9 1
A __construct() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Pluswerk\TypoScriptAutoFixer;
5
6
use Pluswerk\TypoScriptAutoFixer\Adapter\Linter;
7
8
class FileBuilder
9
{
10
    /**
11
     * @var Linter
12
     */
13
    private $linter;
14
15
    /**
16
     * FileBuilder constructor.
17
     *
18
     * @param Linter|null $linter
19
     */
20
    public function __construct(Linter $linter = null)
21
    {
22
        $this->linter = $linter ?? new Linter();
23
    }
24
25
    /**
26
     * @param string $filePath
27
     *
28
     * @return File
29
     */
30
    public function buildFile(string $filePath): File
31
    {
32
        $file = new File($filePath);
33
34
        $issueCollection = $this->linter->lint($filePath);
35
36
        $file->updateIssueCollection($issueCollection);
37
38
        return $file;
39
    }
40
}
41