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

ImportProcessEvent::getContext()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 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 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