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

UserMessageValidator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 5
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A loginUserValidator() 0 4 1
A logoutUserValidator() 0 4 1
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\Validator\Assert;
15
use Cubiche\Core\Validator\Exception\ValidationException;
16
use Cubiche\Core\Validator\Validator;
17
18
/**
19
 * UserMessageValidator class.
20
 *
21
 * @author Ivannis Suárez Jerez <[email protected]>
22
 */
23
class UserMessageValidator
24
{
25
    /**
26
     * @param LoginUserMessage $event
27
     *
28
     * @return bool
29
     */
30
    public function loginUserValidator(LoginUserMessage $event)
31
    {
32
        Validator::assert($event->email(), Assert::email()->contains('gmail.com'));
33
    }
34
35
    /**
36
     * @param LogoutUserMessage $event
37
     *
38
     * @return bool
39
     */
40
    public function logoutUserValidator(LogoutUserMessage $event)
0 ignored issues
show
Unused Code introduced by
The parameter $event is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
41
    {
42
        throw new ValidationException('The email is invalid');
43
    }
44
}
45