Completed
Branch master (c5ceed)
by Tomáš
33:54 queued 13:17
created

Configuration   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 72
ccs 0
cts 32
cp 0
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A resolveFromArray() 0 9 1
A getStandards() 0 4 1
A getSniff() 0 4 1
A getReportClass() 0 4 1
A getSource() 0 4 1
A isFixer() 0 4 1
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\Configuration;
9
10
use Symplify\PHP7_CodeSniffer\Configuration\ConfigurationResolver;
11
12
final class Configuration
13
{
14
    /**
15
     * @var array
16
     */
17
    private $standards = [];
18
19
    /**
20
     * @var string
21
     */
22
    private $reportClass;
23
24
    /**
25
     * @var ConfigurationResolver
26
     */
27
    private $configurationResolver;
28
29
    /**
30
     * @var string[]
31
     */
32
    private $sniffs = [];
33
34
    /**
35
     * @var array
36
     */
37
    private $source = [];
38
39
    /**
40
     * @var bool
41
     */
42
    private $isFixer;
43
44
    public function __construct(ConfigurationResolver $configurationResolver)
45
    {
46
        $this->configurationResolver = $configurationResolver;
47
    }
48
49
    public function resolveFromArray(array $options)
50
    {
51
        $options = $this->configurationResolver->resolve($options);
52
53
        $this->standards = $options['standards'];
54
        $this->sniffs = $options['sniffs'];
55
        $this->source = $options['source'];
56
        $this->isFixer = $options['fix'];
57
    }
58
59
    public function getStandards() : array
60
    {
61
        return $this->standards;
62
    }
63
64
    public function getSniff() : array
65
    {
66
        return $this->sniffs;
67
    }
68
69
    public function getReportClass() : string
70
    {
71
        return $this->reportClass;
72
    }
73
74
    public function getSource() : array
75
    {
76
        return $this->source;
77
    }
78
79
    public function isFixer() : bool
80
    {
81
        return $this->isFixer;
82
    }
83
}
84