Completed
Push — master ( 0fb3d7...53ff75 )
by Markus
03:02
created

ImportProcessEvent::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 3
cts 4
cp 0.75
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
crap 2.0625
1
<?php
2
namespace Mathielen\DataImport\Event;
3
4
use Symfony\Component\EventDispatcher\Event;
5
6
class ImportProcessEvent extends Event
7
{
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
}
43