Completed
Pull Request — master (#36)
by Rick
02:24
created

Form   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 45
rs 10
wmc 4
lcom 1
cbo 2

4 Methods

Rating   Name   Duplication   Size   Complexity  
A action() 0 4 1
A method() 0 4 1
A acceptsFiles() 0 4 1
A route() 0 4 1
1
<?php
2
3
namespace Spatie\Html\Elements;
4
5
use Spatie\Html\BaseElement;
6
use Illuminate\Support\Traits\Macroable;
7
8
class Form extends BaseElement
9
{
10
    use Macroable;
11
12
    protected $tag = 'form';
13
14
    /**
15
     * @param string|null $action
16
     *
17
     * @return static
18
     */
19
    public function action($action)
20
    {
21
        return $this->attribute('action', $action);
22
    }
23
24
    /**
25
     * @param string|null $method
26
     *
27
     * @return static
28
     */
29
    public function method($method)
30
    {
31
        return $this->attribute('method', $method);
32
    }
33
34
    /**
35
     * @return static
36
     */
37
    public function acceptsFiles()
38
    {
39
        return $this->attribute('enctype', 'multipart/form-data');
40
    }
41
42
    /**
43
     * @param string $route
44
     * @param array $parameters
45
     *
46
     * @return static
47
     */
48
    public function route($route, $parameters = [])
49
    {
50
        return $this->action(app('url')->route($route, $parameters));
51
    }
52
}
53