Completed
Push — master ( a822fd...f88949 )
by Rémi
05:42
created

CommandParserTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 16
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A checkUser() 0 9 2
1
<?php
2
3
namespace MessageApp\Parser;
4
5
use MessageApp\Parser\Exception\MessageParserException;
6
use MessageApp\User\ApplicationUser;
7
use MessageApp\User\UndefinedApplicationUser;
8
9
trait CommandParserTrait
10
{
11
    /**
12
     * @param ApplicationUser $user
13
     * @throws MessageParserException
14
     */
15 6
    protected function checkUser(ApplicationUser $user)
16
    {
17 6
        if ($user instanceof UndefinedApplicationUser) {
18 3
            throw new MessageParserException(
19 2
                $user,
20 1
                'User is not valid!'
21 2
            );
22
        }
23 3
    }
24
}
25