Completed
Push — master ( 0485d1...406540 )
by Markus
03:25 queued 40s
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.2559

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 3
cts 5
cp 0.6
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
crap 2.2559
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