InputList::get()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 7
rs 10
1
<?php
2
3
4
namespace EasyPanel\Parsers\HTMLInputs;
5
6
7
abstract class InputList
8
{
9
    const inputClassMap = [
10
        'password' => Password::class,
11
        'text' => Text::class,
12
        'file' => File::class,
13
        'email' => Email::class,
14
        'number' => Number::class,
15
        'textarea' => Textarea::class,
16
        'select' => Select::class,
17
        'ckeditor' => Ckeditor::class,
18
        'checkbox' => Checkbox::class,
19
        'date' => Date::class,
20
        'datetime' => DateTime::class,
21
        'time' => Time::class,
22
    ];
23
24
    public static function get($name)
25
    {
26
        if (!key_exists($name, static::inputClassMap)){
27
            throw new \Exception("The [$name] input type doesn't exist in input list!");
28
        }
29
30
        return static::inputClassMap[$name];
31
    }
32
}
33