DumpFileStep   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 12 1
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 DumpFileStep extends AbstractStep
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function execute(ConsumerEvent $event, $directory)
25
    {
26
        $this->triggerNewStep($event, ['message' => 'Starting async job']);
27
28
        $this->filesystem->mkdir($this->workingTempPath.'/'.$directory);
29
        $this->filesystem->dumpFile(
30
            sprintf('%s/%s/composer.json', $this->workingTempPath, $directory),
31
            $event->getMessage()->getValue('body')
32
        );
33
34
        return 0;
35
    }
36
}
37