cubiche /
bus
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 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 | * LoginUserMessage class. |
||
| 20 | * |
||
| 21 | * @author Ivannis Suárez Jerez <[email protected]> |
||
| 22 | */ |
||
| 23 | View Code Duplication | class LoginUserMessage implements MessageInterface |
|
|
0 ignored issues
–
show
|
|||
| 24 | { |
||
| 25 | /** |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | protected $email; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * LoginUserMessage 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() |
||
| 64 | ); |
||
| 65 | } |
||
| 66 | } |
||
| 67 |
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.