TableDropperFactory::create()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 2
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
}
20