UploadComposerConsumer   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A process() 0 12 3
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;
13
14
use Sonata\NotificationBundle\Consumer\ConsumerEvent;
15
use Sonata\NotificationBundle\Consumer\ConsumerInterface;
16
17
class UploadComposerConsumer implements ConsumerInterface
18
{
19
    protected $steps;
20
21
    /**
22
     * Constructor.
23
     *
24
     * @param array $steps
25
     */
26
    public function __construct(array $steps)
27
    {
28
        $this->steps = $steps;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function process(ConsumerEvent $event)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
35
    {
36
        $directory = uniqid('composer', true);
37
38
        foreach ($this->steps as $step) {
39
            if (0 !== $return = $step->execute($event, $directory)) {
40
                return $return;
41
            }
42
        }
43
44
        return 0;
45
    }
46
}
47