Code Duplication    Length = 28-32 lines in 2 locations

src/Webcreate/Conveyor/Subscriber/BuilderSubscriber.php 1 location

@@ 63-94 (lines=32) @@
60
        }
61
    }
62
63
    public function onBuilderPreTask(GenericEvent $event)
64
    {
65
        if (true === $this->showProgress) {
66
            return;
67
        }
68
69
        $task = $event->getSubject();
70
        $io   = $this->io;
71
72
        $self = $this;
73
74
        $task->setOutput(function ($output) use ($io, $self) {
75
            if ($io->isVerbose()) {
76
                $io->write(sprintf('%s', $output));
77
                $self->needsNewline = false;
78
            } else {
79
                $io->overwrite(sprintf('%s', $output), false);
80
                $self->needsNewline = true;
81
            }
82
        });
83
84
        if ($event->getArgument('index') > 0) {
85
            if (true === $this->needsNewline) {
86
                $this->io->write('');
87
                $this->needsNewline = false;
88
            }
89
            $this->io->write('');
90
        }
91
92
        $this->io->write(sprintf('- Executing task <info>%s</info>', get_class($task)));
93
        $this->io->increaseIndention(2);
94
    }
95
96
    public function onBuilderPostTask(GenericEvent $event)
97
    {

src/Webcreate/Conveyor/Subscriber/TaskRunnerSubscriber.php 1 location

@@ 38-65 (lines=28) @@
35
        );
36
    }
37
38
    public function onTaskPreExecute(GenericEvent $event)
39
    {
40
        $task = $event->getSubject();
41
        $io   = $this->io;
42
43
        $self = $this;
44
45
        $task->setOutput(function ($output) use ($io, $self) {
46
            if ($io->isVerbose()) {
47
                $io->write(sprintf('%s', $output));
48
                $self->needsNewline = false;
49
            } else {
50
                $io->overwrite(sprintf('%s', $output), false);
51
                $self->needsNewline = true;
52
            }
53
        });
54
55
        if ($event->getArgument('index') > 0) {
56
            if (true === $this->needsNewline) {
57
                $this->io->write('');
58
                $this->needsNewline = false;
59
            }
60
            $this->io->write('');
61
        }
62
63
        $this->io->write(sprintf('- Executing task <info>%s</info>', get_class($task)));
64
        $this->io->increaseIndention(2);
65
    }
66
67
    public function onTaskPostExecute(GenericEvent $event)
68
    {