Completed
Push — master ( e3fefc...6fb92f )
by Tomáš
8s
created

CodeBeautifierFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of Symplify
5
 * Copyright (c) 2016 Tomas Votruba (http://tomasvotruba.cz).
6
 */
7
8
namespace Symplify\MultiCodingStandard\CodeSniffer;
9
10
use Symplify\MultiCodingStandard\Contract\CodeSniffer\CodeBeautifierFactoryInterface;
11
use Symplify\MultiCodingStandard\Contract\CodeSniffer\CodeSnifferFactoryInterface;
12
13
final class CodeBeautifierFactory implements CodeBeautifierFactoryInterface
14
{
15
    /**
16
     * @var CodeSnifferFactoryInterface
17
     */
18
    private $codeSnifferFactory;
19
20
    public function __construct(CodeSnifferFactoryInterface $codeSnifferFactory)
21
    {
22
        $this->codeSnifferFactory = $codeSnifferFactory;
23
    }
24
25
    /**
26
     * @return CodeBeautifier
27
     */
28
    public function create()
29
    {
30
        // high verbosity
31
        if (!defined('PHP_CODESNIFFER_VERBOSITY')) {
32
            define('PHP_CODESNIFFER_VERBOSITY', 1);
33
        }
34
35
        // enables fixer
36
        if (!defined('PHP_CODESNIFFER_CBF')) {
37
            define('PHP_CODESNIFFER_CBF', true);
38
        }
39
40
        return $this->codeSnifferFactory->create();
41
    }
42
}
43