Completed
Push — master ( 4e4f47...806721 )
by Ivannis Suárez
02:27
created

RemoveUserMessage::email()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of the Cubiche package.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Cubiche\Core\Bus\Tests\Fixtures\Message;
13
14
use Cubiche\Core\Bus\MessageInterface;
15
use Cubiche\Core\Validator\Assert;
16
use Cubiche\Core\Validator\Mapping\ClassMetadata;
17
18
/**
19
 * RemoveUserMessage class.
20
 *
21
 * @author Ivannis Suárez Jerez <[email protected]>
22
 */
23 View Code Duplication
class RemoveUserMessage implements MessageInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
{
25
    /**
26
     * @var string
27
     */
28
    protected $email;
29
30
    /**
31
     * RemoveUserMessage constructor.
32
     *
33
     * @param $email
34
     */
35
    public function __construct($email)
36
    {
37
        $this->setEmail($email);
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function email()
44
    {
45
        return $this->email;
46
    }
47
48
    /**
49
     * @param string $email
50
     */
51
    public function setEmail($email)
52
    {
53
        $this->email = $email;
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public static function loadValidatorMetadata(ClassMetadata $classMetadata)
60
    {
61
        $classMetadata->addPropertyConstraint(
62
            'email',
63
            Assert::email()
0 ignored issues
show
Compatibility introduced by
\Cubiche\Core\Validator\Assert::email() of type object<Respect\Validation\Validator> is not a sub-type of object<Cubiche\Core\Validator\Assert>. It seems like you assume a child class of the class Respect\Validation\Validator to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
64
        );
65
    }
66
}
67