GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (113)

src/Component/PharUpdate/Console/Command.php (1 issue)

1
<?php
2
namespace Deployer\Component\PharUpdate\Console;
3
4
use LogicException;
5
use Symfony\Component\Console\Command\Command as Base;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Input\InputOption;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
/**
11
 * Manages updating or upgrading the Phar.
12
 *
13
 * @author Kevin Herrera <[email protected]>
14
 */
15
class Command extends Base
16
{
17
    /**
18
     * Disable the ability to upgrade?
19
     *
20
     * @var boolean
21
     */
22
    private $disableUpgrade = false;
23
24
    /**
25
     * The manifest file URI.
26
     *
27
     * @var string
28
     */
29
    private $manifestUri;
30
31
    /**
32
     * @param string  $name    The command name.
33
     * @param boolean $disable Disable upgrading?
34
     */
35
    public function __construct($name, $disable = false)
36
    {
37
        $this->disableUpgrade = $disable;
38
39
        parent::__construct($name);
40
    }
41
42
    /**
43
     * Sets the manifest URI.
44
     *
45
     * @param string $uri The URI.
46
     */
47
    public function setManifestUri($uri)
48
    {
49
        $this->manifestUri = $uri;
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    protected function configure()
56
    {
57
        $this->setDescription('Updates the application.');
58
        $this->addOption(
59
            'pre',
60
            'p',
61
            InputOption::VALUE_NONE,
62
            'Allow pre-release updates.'
63
        );
64
        $this->addOption(
65
            'redo',
66
            'r',
67
            InputOption::VALUE_NONE,
68
            'Redownload update if already using current version.'
69
        );
70
71
        if (false === $this->disableUpgrade) {
72
            $this->addOption(
73
                'upgrade',
74
                'u',
75
                InputOption::VALUE_NONE,
76
                'Upgrade to next major release, if available.'
77
            );
78
        }
79
    }
80
81
    /**
82
     * {@inheritdoc}
83
     */
84
    protected function execute(InputInterface $input, OutputInterface $output)
85
    {
86
        if (null === $this->manifestUri) {
87
            throw new LogicException(
88
                'No manifest URI has been configured.'
89
            );
90
        }
91
92
        $output->writeln('Looking for updates...');
93
94
        /** @var $pharUpdate Helper */
95
        $pharUpdate = $this->getHelper('phar-update');
96
        $manager = $pharUpdate->getManager($this->manifestUri);
97
98
        if ($manager->update(
99
            $this->getApplication()->getVersion(),
100
            $this->disableUpgrade ?: (false === $input->getOption('upgrade')),
101
            $input->getOption('pre')
102
        )){
103
            $output->writeln('<info>Update successful!</info>');
104
        } else {
105
            $output->writeln('<comment>Already up-to-date.</comment>');
106
        }
107
108
        // Force exit to prevent warnings
109
        die(0);
0 ignored issues
show
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
110
    }
111
}
112