Completed
Push — master ( 7b874e...422ca2 )
by Rémi
03:25
created

GameErrorTextExtractor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

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
    public function extractMessage($object)
18
    {
19
        if (!$object instanceof MiniGameAppErrorEvent) {
20
            return null;
21
        }
22
23
        return new TranslatableResource(
24
            $object->getAsMessage()
25
        );
26
    }
27
}
28