Completed
Push — master ( 12e90d...d3ba5d )
by Freek
06:17
created

TableDropperFactory::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 10
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace Spatie\MigrateFresh;
4
5
use Spatie\MigrateFresh\TableDroppers\TableDropper;
6
7
class TableDropperFactory
8
{
9
    public static function create($driverName): TableDropper
10
    {
11
        $dropperClass = '\\Spatie\\MigrateFresh\\TableDroppers\\'.ucfirst($driverName);
12
13
        if (! class_exists($dropperClass)) {
14
            throw CannotDropTables::unsupportedDbDriver($driverName);
15
        }
16
17
        return new $dropperClass;
18
    }
19
}