Completed
Push — develop ( 72aae6...d42c3f )
by Freddie
02:15
created

Input::create()

Size

Total Lines 17
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
nc 1
nop 3
dl 0
loc 17

2 Methods

Rating   Name   Duplication   Size   Complexity  
A Input.php$0 ➔ __construct() 0 5 1
A Input.php$0 ➔ getType() 0 3 1
1
<?php
2
3
namespace FlexPHP\Inputs;
4
5
use FlexPHP\Inputs\Builder\AbstractBuilder;
6
7
/**
8
 * @method static string text()
9
 */
10
class Input implements InputInterface
11
{
12
    /** @codeCoverageIgnore */
13
    private function __construct()
14
    {
15
    }
16
17
    public static function create(string $type, string $name, array $options = []): string
18
    {
19
        return (new class($type, $name, $options) extends AbstractBuilder {
20
            protected $type;
21
22
            public function __construct($type, $name, $options)
23
            {
24
                $this->type = $type;
25
26
                parent::__construct($name, $options);
27
            }
28
29
            protected function getType(): string
30
            {
31
                return $this->type;
32
            }
33
        })->render();
34
    }
35
36
    public static function __callStatic($name, $arguments)
37
    {
38
        return self::create($name, ...$arguments);
0 ignored issues
show
Bug introduced by
$arguments is expanded, but the parameter $name of FlexPHP\Inputs\Input::create() does not expect variable arguments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

38
        return self::create($name, /** @scrutinizer ignore-type */ ...$arguments);
Loading history...
39
    }
40
}
41