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

CommandParserTrait::checkUser()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 9
rs 9.6666
cc 2
eloc 5
nc 2
nop 1
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