ComposerInstalledStep   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 12 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