1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the humbug/php-scoper package. |
7
|
|
|
* |
8
|
|
|
* Copyright (c) 2017 Théo FIDRY <[email protected]>, |
9
|
|
|
* Pádraic Brady <[email protected]> |
10
|
|
|
* |
11
|
|
|
* For the full copyright and license information, please view the LICENSE |
12
|
|
|
* file that was distributed with this source code. |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace Humbug\PhpScoper\Console; |
16
|
|
|
|
17
|
|
|
use Humbug\PhpScoper\Container; |
18
|
|
|
use Symfony\Component\Console\Application as SymfonyApplication; |
19
|
|
|
use function Humbug\PhpScoper\get_php_scoper_version; |
20
|
|
|
use function trim; |
21
|
|
|
|
22
|
|
|
final class Application extends SymfonyApplication |
23
|
|
|
{ |
24
|
|
|
private const LOGO = <<<'ASCII' |
25
|
|
|
|
26
|
|
|
____ __ ______ _____ |
27
|
|
|
/ __ \/ / / / __ \ / ___/_________ ____ ___ _____ |
28
|
|
|
/ /_/ / /_/ / /_/ / \__ \/ ___/ __ \/ __ \/ _ \/ ___/ |
29
|
|
|
/ ____/ __ / ____/ ___/ / /__/ /_/ / /_/ / __/ / |
30
|
|
|
/_/ /_/ /_/_/ /____/\___/\____/ .___/\___/_/ |
31
|
|
|
/_/ |
32
|
|
|
|
33
|
|
|
|
34
|
|
|
ASCII; |
35
|
|
|
|
36
|
|
|
private $container; |
37
|
|
|
private $releaseDate; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* {@inheritdoc} |
41
|
|
|
*/ |
42
|
|
|
public function __construct( |
43
|
|
|
Container $container, |
44
|
|
|
string $name = 'Box', |
45
|
|
|
?string $version = null, |
46
|
|
|
string $releaseDate = '@release-date@' |
47
|
|
|
) { |
48
|
|
|
$this->container = $container; |
49
|
|
|
$this->releaseDate = false === strpos($releaseDate, '@') ? $releaseDate : ''; |
50
|
|
|
|
51
|
|
|
parent::__construct($name, $version ?? get_php_scoper_version()); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function getContainer(): Container |
55
|
|
|
{ |
56
|
|
|
return $this->container; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @inheritdoc |
61
|
|
|
*/ |
62
|
|
|
public function getLongVersion(): string |
63
|
|
|
{ |
64
|
|
|
return trim( |
65
|
|
|
sprintf( |
66
|
|
|
'<info>%s</info> version <comment>%s</comment> %s', |
67
|
|
|
$this->getName(), |
68
|
|
|
$this->getVersion(), |
69
|
|
|
$this->releaseDate |
70
|
|
|
) |
71
|
|
|
); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @inheritdoc |
76
|
|
|
*/ |
77
|
|
|
public function getHelp(): string |
78
|
|
|
{ |
79
|
|
|
return self::LOGO.parent::getHelp(); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|