ConfirmEmailTask::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the login-cidadao project or it's bundles.
4
 *
5
 * (c) Guilherme Donato <guilhermednt on github>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace LoginCidadao\CoreBundle\Model;
12
13
use LoginCidadao\TaskStackBundle\Model\AbstractTask;
14
use LoginCidadao\TaskStackBundle\Model\TaskTargetInterface;
15
16
class ConfirmEmailTask extends AbstractTask
17
{
18
    /** @var bool */
19
    private $isMandatory;
20
21
    /** @var TaskTargetInterface */
22
    private $target;
23
24
    /**
25
     * ConfirmEmailTask constructor.
26
     * @param TaskTargetInterface $target
27
     * @param bool $mandatory
28
     */
29
    public function __construct(TaskTargetInterface $target, $mandatory = false)
30
    {
31
        $this->target = $target;
32
        $this->isMandatory = $mandatory;
33
    }
34
35
    /**
36
     * Returns a value that can be used to identify a task. This is used to avoid repeated Tasks in the TaskStack.
37
     *
38
     * If a Task is specific to a given RP this method could return something like {TASK_NAME}_{RP_ID}
39
     *
40
     * @return string
41
     */
42
    public function getId()
43
    {
44
        return 'lc.task.confirm_email';
45
    }
46
47
    public function getRoutes()
48
    {
49
        return [
50
            'task_confirm_email',
51
            'fos_user_registration_confirm',
52
            'wait_valid_email',
53
        ];
54
    }
55
56
    /**
57
     * @return boolean
58
     */
59
    public function isMandatory()
60
    {
61
        return $this->isMandatory;
62
    }
63
64
    /**
65
     * @return TaskTargetInterface
66
     */
67
    public function getTarget()
68
    {
69
        return $this->target;
70
    }
71
}
72