Form   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A spoofedMethod() 0 3 1
A __construct() 0 3 1
A httpMethod() 0 7 2
A render() 0 3 1
1
<?php
2
3
4
namespace Saimondev03;
5
6
use Illuminate\View\Component;
7
8
class Form extends Component
9
{
10
    /**
11
     * @var string
12
     */
13
    public $method;
14
15
    public function __construct(string $method = 'get')
16
    {
17
        $this->method = $method;
18
    }
19
20
    public function httpMethod()
21
    {
22
        if ($this->spoofedMethod()) {
23
            return 'post';
24
        }
25
26
        return $this->method;
27
    }
28
29
    public function spoofedMethod()
30
    {
31
        return in_array($this->method, ['put', 'patch', 'delete']);
32
    }
33
    public function render()
34
    {
35
        return view('saimondev03-form::form');
36
    }
37
}
38