Completed
Pull Request — develop (#27)
by Chris
01:52
created

InfReverser::reverse()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace Chrisyue\PhpM3u8\Transformer;
4
5
class InfReverser implements ReverserInterface
6
{
7
    public function reverse($inf)
8
    {
9
        $format = '%d,%s';
10
        if (is_float($inf->duration)) {
11
            $format = '%.3f,%s';
12
        }
13
14
        return sprintf($format, $inf->duration, $inf->title);
15
    }
16
}
17