Completed
Push — master ( 0485d1...406540 )
by Markus
03:25 queued 40s
created

ImportProcessEvent   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 85.71%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 5
c 4
b 0
f 0
lcom 1
cbo 2
dl 0
loc 35
ccs 12
cts 14
cp 0.8571
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setContext() 0 4 1
A getContext() 0 4 1
A __construct() 0 6 2
A newItemEvent() 0 7 1
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 11
    public function __construct($context = null)
15
    {
16 11
        if ($context) {
17
            $this->setContext($context);
18
        }
19 11
    }
20
21 10
    public function setContext($context)
22
    {
23 10
        $this->context = $context;
24 10
    }
25
26 8
    public function getContext()
27
    {
28 8
        return $this->context;
29
    }
30
31
    /**
32
     * @return ImportItemEvent
33
     */
34 11
    public function newItemEvent($item)
35
    {
36 11
        $event = new ImportItemEvent($item);
37 11
        $event->setContext($this->context);
38
39 11
        return $event;
40
    }
41
}
42