|
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 Webmozart\PhpScoper\Formatter; |
|
15
|
|
|
|
|
16
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
17
|
|
|
use Webmozart\PhpScoper\Console\Application; |
|
18
|
|
|
|
|
19
|
|
|
class BasicFormatter |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* @var OutputInterface |
|
23
|
|
|
*/ |
|
24
|
|
|
protected $io; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @param OutputInterface $output |
|
28
|
|
|
*/ |
|
29
|
6 |
|
public function __construct(OutputInterface $output) |
|
30
|
|
|
{ |
|
31
|
6 |
|
$this->io = $output; |
|
32
|
6 |
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Output version details at start. |
|
36
|
|
|
*/ |
|
37
|
6 |
|
public function outputScopingStart() |
|
38
|
|
|
{ |
|
39
|
6 |
|
if (Application::VERSION == '@package_version@') { |
|
40
|
6 |
|
$version = '1.0-dev'; |
|
41
|
|
|
} else { |
|
42
|
|
|
$version = Application::VERSION; |
|
43
|
|
|
} |
|
44
|
6 |
|
$this->io->writeLn(sprintf('PHP Scoper %s', $version)); |
|
45
|
6 |
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Output file count message if relevant. |
|
49
|
|
|
* |
|
50
|
|
|
* @param int $count |
|
51
|
|
|
*/ |
|
52
|
5 |
|
public function outputFileCount(int $count) |
|
53
|
|
|
{ |
|
54
|
5 |
|
if (0 === $count) { |
|
55
|
1 |
|
$this->io->writeLn('No PHP files to scope located with given path(s).'); |
|
56
|
|
|
} |
|
57
|
5 |
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Output scoping success message. |
|
61
|
|
|
* |
|
62
|
|
|
* @param string $path |
|
63
|
|
|
*/ |
|
64
|
3 |
|
public function outputSuccess(string $path) |
|
65
|
|
|
{ |
|
66
|
3 |
|
$this->io->writeLn(sprintf('Scoping %s. . . Success', $path)); |
|
67
|
3 |
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Output scoping failure message. |
|
71
|
|
|
* |
|
72
|
|
|
* @param string $path |
|
73
|
|
|
*/ |
|
74
|
1 |
|
public function outputFail(string $path) |
|
75
|
|
|
{ |
|
76
|
1 |
|
$this->io->writeLn(sprintf('Scoping %s. . . Fail', $path)); |
|
77
|
1 |
|
} |
|
78
|
|
|
|
|
79
|
5 |
|
public function outputScopingEnd() |
|
80
|
|
|
{ |
|
81
|
5 |
|
} |
|
82
|
|
|
} |
|
83
|
|
|
|