GameErrorTextExtractor   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A extractMessage() 0 10 2
1
<?php
2
3
namespace MiniGameMessageApp\Message;
4
5
use MessageApp\Message\TextExtractor\MessageTextExtractor;
6
use MiniGameApp\Event\MiniGameAppErrorEvent;
7
use RemiSan\Intl\TranslatableResource;
8
9
class GameErrorTextExtractor implements MessageTextExtractor
10
{
11
    /**
12
     * Extract the message from the game result.
13
     *
14
     * @param  object $object
15
     * @return TranslatableResource
16
     */
17 6
    public function extractMessage($object)
18
    {
19 6
        if (!$object instanceof MiniGameAppErrorEvent) {
20 3
            return null;
21
        }
22
23 3
        return new TranslatableResource(
24 3
            $object->getAsMessage()
25 2
        );
26
    }
27
}
28