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

Input   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 29
rs 10
wmc 4

7 Methods

Rating   Name   Duplication   Size   Complexity  
A hp$0 ➔ __construct() 0 5 1
A __construct() 0 2 1
__callStatic() 0 3 ?
A hp$0 ➔ getType() 0 3 1
A hp$0 ➔ __callStatic() 0 3 1
create() 0 17 ?
A hp$0 ➔ create() 0 17 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