Passed
Branch master (e090ea)
by kacper
04:22
created

GtidFactory::makeCollectionFromString()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
crap 2
1
<?php
2
3
namespace MySQLReplication\Gtid;
4
5
/**
6
 * Class GtidService
7
 * @package MySQLReplication\Gtid
8
 */
9
class GtidFactory
10
{
11
    /**
12
     * @param string $gtids
13
     * @return GtidCollection
14
     * @throws GtidException
15
     */
16 1
    public static function makeCollectionFromString($gtids)
17
    {
18 1
        $collection = new GtidCollection();
19 1
        foreach (array_filter(explode(',', $gtids)) as $gtid) {
20 1
            $collection->add(new Gtid($gtid));
21 1
        }
22
23 1
        return $collection;
24
    }
25
}