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

CodeBeautifierFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 4
c 2
b 0
f 1
lcom 1
cbo 1
dl 0
loc 30
ccs 0
cts 9
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 14 3
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