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

OperationFormatter::format()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.0185

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 1
dl 0
loc 7
ccs 5
cts 6
cp 0.8333
crap 2.0185
rs 10
c 0
b 0
f 0
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