Passed
Push — master ( c72848...3af666 )
by Stephen
03:25 queued 01:13
created

FormStatus::withFailure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
4
namespace Sfneal\ViewModels\Traits;
5
6
trait FormStatus
7
{
8
    /**
9
     * Add success status to the view model
10
     *
11
     * @return $this
12
     */
13
    public function withSuccess() {
14
        $this->withStatus('success');
15
        return $this;
16
    }
17
18
    /**
19
     * Add success status to the view model
20
     *
21
     * @return $this
22
     */
23
    public function withFailure() {
24
        $this->withStatus('failure');
25
        return $this;
26
    }
27
28
    /**
29
     * Set a Client Inquiry success/failure status to be displayed in the view model
30
     *
31
     * @param string $status
32
     * @return $this
33
     */
34
    private function withStatus(string $status) {
35
        $this->status = $status;
0 ignored issues
show
Bug Best Practice introduced by
The property status does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
36
        return $this;
37
    }
38
}
39