Test Failed
Pull Request — master (#5)
by Jan-Marten
04:30
created

OperationFormatter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 16
ccs 5
cts 6
cp 0.8333
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A format() 0 7 2
1
<?php
0 ignored issues
show
introduced by
An error occurred during processing; checking has been aborted. The error message was: implode(): Passing glue string after array is deprecated. Swap the parameters in /home/scrutinizer/build/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Commenting/FunctionCommentSniff.php on line 468
Loading history...
2
/**
3
 * Copyright MediaCT. All rights reserved.
4
 * https://www.mediact.nl
5
 */
6
7
namespace Johmanx10\Transaction\Formatter;
8
9
use Johmanx10\Transaction\DescribableOperationInterface;
10
use Johmanx10\Transaction\OperationInterface;
11
12
class OperationFormatter implements OperationFormatterInterface
13
{
14
    /**
15
     * Format the given operation into a readable string.
16
     *
17
     * @param OperationInterface $operation
18
     *
19
     * @return string
20
     */
21 2
    public function format(OperationInterface $operation): string
22
    {
23 2
        return $operation instanceof DescribableOperationInterface
24 1
            ? (string)$operation
25
            : sprintf(
26 1
                'Generic operation %s',
27 2
                spl_object_hash($operation)
28
            );
29
    }
30
}
31