Passed
Push — master ( 2a3624...3abe14 )
by Théo
03:10
created

ConsoleLogger   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 57
ccs 0
cts 20
cp 0
rs 10
c 0
b 0
f 0
wmc 7
lcom 1
cbo 2

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A outputScopingStart() 0 6 1
A outputFileCount() 0 6 2
A outputSuccess() 0 4 1
A outputFail() 0 4 1
A outputScopingEnd() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
/*
5
 * This file is part of the humbug/php-scoper package.
6
 *
7
 * Copyright (c) 2017 Théo FIDRY <[email protected]>,
8
 *                    Pádraic Brady <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Humbug\PhpScoper\Logger;
15
16
use Symfony\Component\Console\Application;
17
use Symfony\Component\Console\Output\OutputInterface;
18
19
/**
20
 * @private
21
 * @final
22
 */
23
class ConsoleLogger
24
{
25
    private $application;
26
    private $io;
27
28
    public function __construct(Application $application, OutputInterface $output)
29
    {
30
        $this->io = $output;
31
        $this->application = $application;
32
    }
33
34
    /**
35
     * Output version details at start.
36
     */
37
    public function outputScopingStart()
38
    {
39
        $version = $this->application->getVersion();
40
41
        $this->io->writeLn(sprintf('PHP Scoper %s', $version));
42
    }
43
44
    /**
45
     * Output file count message if relevant.
46
     *
47
     * @param int $count
48
     */
49
    public function outputFileCount(int $count)
50
    {
51
        if (0 === $count) {
52
            $this->io->writeLn('No PHP files to scope located with given path(s).');
53
        }
54
    }
55
56
    /**
57
     * Output scoping success message.
58
     *
59
     * @param string $path
60
     */
61
    public function outputSuccess(string $path)
62
    {
63
        $this->io->writeLn(sprintf('Scoping %s. . . Success', $path));
64
    }
65
66
    /**
67
     * Output scoping failure message.
68
     *
69
     * @param string $path
70
     */
71
    public function outputFail(string $path)
72
    {
73
        $this->io->writeLn(sprintf('Scoping %s. . . Fail', $path));
74
    }
75
76
    public function outputScopingEnd()
77
    {
78
    }
79
}
80