Debug   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getDescription() 0 4 1
A execute() 0 5 1
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * This file is part of phpDocumentor.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author    Mike van Riel <[email protected]>
11
 * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
12
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
13
 * @link      http://phpdoc.org
14
 */
15
16
namespace phpDocumentor\Compiler\Pass;
17
18
use phpDocumentor\Compiler\CompilerPassInterface;
19
use phpDocumentor\Descriptor\ProjectAnalyzer;
20
use phpDocumentor\Descriptor\ProjectDescriptor;
21
use Psr\Log\LoggerInterface;
22
23
/**
24
 * This class is responsible for sending statistical information to the log.
25
 *
26
 * For debugging purposes it can be convenient to send statistical information about the
27
 * ProjectDescriptor to the log of phpDocumentor.
28
 */
29
class Debug implements CompilerPassInterface
30
{
31
    const COMPILER_PRIORITY = 1000;
32
33
    /** @var LoggerInterface $log the logger to write the debug results to */
34
    protected $log;
35
36
    /** @var ProjectAnalyzer $analyzer service that compiles a summary of the project */
37
    protected $analyzer;
38
39
    /**
40
     * Registers the logger with this Compiler Pass.
41
     */
42 1
    public function __construct(LoggerInterface $log, ProjectAnalyzer $analyzer)
43
    {
44 1
        $this->log = $log;
45 1
        $this->analyzer = $analyzer;
46 1
    }
47
48 1
    public function getDescription(): string
49
    {
50 1
        return 'Analyze results and write report to log';
51
    }
52
53 1
    public function execute(ProjectDescriptor $project): void
54
    {
55 1
        $this->analyzer->analyze($project);
56 1
        $this->log->debug((string) $this->analyzer);
57 1
    }
58
}
59