ComposerInstalledStep::execute()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 2
1
<?php
2
3
/*
4
 * This file is part of `Composer as a service`.
5
 *
6
 * (c) Pascal Borreli <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ayaline\Bundle\ComposerBundle\Consumer\Step;
13
14
use Sonata\NotificationBundle\Consumer\ConsumerEvent;
15
16
/**
17
 * @author Hubert Moutot <[email protected]>
18
 */
19
class ComposerInstalledStep extends AbstractStep
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function execute(ConsumerEvent $event, $directory)
25
    {
26
        $output = null;
27
        $workingDirectory = $this->workingTempPath.'/'.$directory;
28
29
        $process = $this->runProcess(sprintf('%s show --installed', $this->composerBinPath), $workingDirectory, $output);
30
        if ($process->isSuccessful()) {
31
            $this->triggerComposerInstalled($event, ['message' => $process->getOutput()]);
32
        }
33
34
        return 0;
35
    }
36
}
37