MarkingStore   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
eloc 10
c 1
b 0
f 1
dl 0
loc 29
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getMarking() 0 15 3
A setMarking() 0 2 1
1
<?php
2
3
/*
4
 * This file is part of the Veslo project <https://github.com/symfony-doge/veslo>.
5
 *
6
 * (C) 2019 Pavel Petrov <[email protected]>.
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @license https://opensource.org/licenses/GPL-3.0 GPL-3.0
12
 */
13
14
declare(strict_types=1);
15
16
namespace Veslo\AppBundle\Workflow\Vacancy\Research;
17
18
use Symfony\Component\Workflow\Marking;
19
use Symfony\Component\Workflow\MarkingStore\MarkingStoreInterface;
20
use Veslo\AnthillBundle\Dto\Vacancy\LocationDto;
21
use Veslo\AnthillBundle\Dto\Vacancy\Parser\ParsedDto;
22
use Veslo\AppBundle\Enum\Workflow\Vacancy\Research\Place;
23
use Veslo\AppBundle\Workflow\Vacancy\Research\Conveyor\Payload;
24
25
/**
26
 * Converts the Marking into something understandable by the subject and vice versa
27
 */
28
class MarkingStore implements MarkingStoreInterface
29
{
30
    /**
31
     * {@inheritdoc}
32
     *
33
     * @param Payload $subject Data structure for processing in workflow
34
     */
35
    public function getMarking($subject)
36
    {
37
        $dto = $subject->getData();
38
39
        $representation = [];
40
41
        if ($dto instanceof LocationDto) {
42
            $representation[Place::FOUND] = null;
43
        } elseif ($dto instanceof ParsedDto) {
44
            $representation[Place::PARSED] = null;
45
        } else {
46
            $representation[Place::COLLECTED] = null;
47
        }
48
49
        return new Marking($representation);
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function setMarking($subject, Marking $marking)
56
    {
57
    }
58
}
59