Completed
Push — master ( 378c5b...5052d2 )
by Markus
08:56
created

ImportProcessEvent   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 92.31%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 35
ccs 12
cts 13
cp 0.9231
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setContext() 0 4 1
A getContext() 0 4 1
A newItemEvent() 0 7 1
A __construct() 0 6 2
1
<?php
2
3
namespace Mathielen\DataImport\Event;
4
5
use Symfony\Component\EventDispatcher\Event;
6
7
class ImportProcessEvent extends Event
8
{
9
    const AFTER_PREPARE = 'data-import.prepare';
10
    const AFTER_FINISH = 'data-import.finish';
11
12
    private $context;
13
14 15
    public function __construct($context = null)
15
    {
16 15
        if ($context) {
17
            $this->setContext($context);
18
        }
19 15
    }
20
21 14
    public function setContext($context)
22
    {
23 14
        $this->context = $context;
24 14
    }
25
26 8
    public function getContext()
27
    {
28 8
        return $this->context;
29
    }
30
31
    /**
32
     * @return ImportItemEvent
33
     */
34 15
    public function newItemEvent($item)
35
    {
36 15
        $event = new ImportItemEvent($item);
37 15
        $event->setContext($this->context);
38
39 15
        return $event;
40
    }
41
}
42