Code Duplication    Length = 31-31 lines in 3 locations

src/Install.php 1 location

@@ 49-79 (lines=31) @@
46
 *     ->run();
47
 * ```
48
 */
49
class Install extends BaseTask implements CommandInterface
50
{
51
    /**
52
     * {@inheritdoc}
53
     */
54
    public function getCommand()
55
    {
56
        if ($this->builder === null) {
57
            throw new \Exception('Package manager not defined');
58
        }
59
60
        $this->builder->install($this->packages)->assumeYes();
61
62
        if (!$this->verbose) {
63
            $this->builder->quiet();
64
        }
65
66
        return $this->builder->getCommand();
67
    }
68
69
    /**
70
     * {@inheritdoc}
71
     */
72
    public function run()
73
    {
74
        $command = $this->getCommand();
75
76
        $this->printTaskInfo('Installing packages...');
77
        return $this->executeCommand($command);
78
    }
79
}
80

src/Uninstall.php 1 location

@@ 40-70 (lines=31) @@
37
 *     ->run();
38
 * ```
39
 */
40
class Uninstall extends BaseTask implements CommandInterface
41
{
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function getCommand()
46
    {
47
        if ($this->builder === null) {
48
            throw new \Exception('Package manager not defined');
49
        }
50
51
        $this->builder->uninstall($this->packages)->assumeYes();
52
53
        if (!$this->verbose) {
54
            $this->builder->quiet();
55
        }
56
57
        return $this->builder->getCommand();
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function run()
64
    {
65
        $command = $this->getCommand();
66
67
        $this->printTaskInfo('Uninstalling packages...');
68
        return $this->executeCommand($command);
69
    }
70
}
71

src/Update.php 1 location

@@ 49-79 (lines=31) @@
46
 *     ->run();
47
 * ```
48
 */
49
class Update extends BaseTask implements CommandInterface
50
{
51
    /**
52
     * {@inheritdoc}
53
     */
54
    public function getCommand()
55
    {
56
        if ($this->builder === null) {
57
            throw new \Exception('Package manager not defined');
58
        }
59
60
        $this->builder->update($this->packages)->assumeYes();
61
62
        if (!$this->verbose) {
63
            $this->builder->quiet();
64
        }
65
66
        return $this->builder->getCommand();
67
    }
68
69
    /**
70
     * {@inheritdoc}
71
     */
72
    public function run()
73
    {
74
        $command = $this->getCommand();
75
76
        $this->printTaskInfo('Updating packages...');
77
        return $this->executeCommand($command);
78
    }
79
}
80