Completed
Push — master ( 5cf284...830bc1 )
by Tomáš
03:38
created

LegacyConfiguration::setup()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
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\PHP7_CodeSniffer\Legacy;
9
10
final class LegacyConfiguration
11
{
12
    public static function setup()
13
    {
14
        self::ensureLineEndingsAreDetected();
15
        self::setupVerbosityToMakeLegacyCodeRun();
16
    }
17
18
    /**
19
     * Ensure this option is enabled or else line endings will not always
20
     * be detected properly for files created on a Mac with the /r line ending.
21
     */
22
    private static function ensureLineEndingsAreDetected()
23
    {
24
        ini_set('auto_detect_line_endings', true);
25
    }
26
27
    private static function setupVerbosityToMakeLegacyCodeRun()
28
    {
29
        if (!defined('PHP_CODESNIFFER_VERBOSITY')) {
30
            define('PHP_CODESNIFFER_VERBOSITY', 0);
31
        }
32
    }
33
}
34