Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
Form
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
3 / 3
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
 action
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 method
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Epic64\Elem\Elements;
6
7use Epic64\Elem\Element;
8
9class Form extends Element
10{
11    public function __construct(?string $action = null, string $method = 'post')
12    {
13        parent::__construct('form');
14        if ($action !== null) {
15            $this->element->setAttribute('action', $action);
16        }
17        $this->element->setAttribute('method', $method);
18    }
19
20    public function action(string $action): static
21    {
22        return $this->attr('action', $action);
23    }
24
25    public function method(string $method): static
26    {
27        return $this->attr('method', $method);
28    }
29}