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

GameErrorTextExtractor::extractMessage()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
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 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
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