extractMessage()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
3
namespace MessageApp\Message\TextExtractor;
4
5
use MessageApp\Parser\Exception\MessageParserException;
6
use RemiSan\Intl\TranslatableResource;
7
8
class MessageParserExceptionTextExtractor implements MessageTextExtractor
9
{
10
    /**
11
     * Extract the message from the game result.
12
     *
13
     * @param  object $object
14
     * @return TranslatableResource
15
     */
16 6
    public function extractMessage($object)
17
    {
18 6
        if (!$object instanceof MessageParserException) {
19 3
            return null;
20
        }
21
22 3
        return new TranslatableResource($object->getCodeName());
23
    }
24
}
25