Completed
Push — master ( d1f51c...0b6237 )
by Rémi
02:46
created

CommandParserTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

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
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
    protected function checkUser(ApplicationUser $user)
16
    {
17
        if ($user instanceof UndefinedApplicationUser) {
18
            throw new MessageParserException(
19
                $user,
20
                'User is not valid!'
21
            );
22
        }
23
    }
24
}
25