FileBuilder::buildFile()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 1
nc 1
nop 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