SoftDeletingScope::withTrashed()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Recca0120\Repository\Concerns;
4
5
use Recca0120\Repository\Method;
6
7
trait SoftDeletingScope
8
{
9
    /**
10
     * Add the with-trashed extension to the builder.
11
     *
12
     * @return $this
13
     */
14 1
    public function withTrashed()
15
    {
16 1
        $this->methods[] = new Method(__FUNCTION__);
0 ignored issues
show
Bug introduced by
The property methods does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
17
18 1
        return $this;
19
    }
20
21
    /**
22
     * Add the without-trashed extension to the builder.
23
     *
24
     * @return $this
25
     */
26
    public function withoutTrashed()
27
    {
28
        $this->methods[] = new Method(__FUNCTION__);
29
30
        return $this;
31
    }
32
33
    /**
34
     * Add the only-trashed extension to the builder.
35
     *
36
     * @return $this
37
     */
38 1
    public function onlyTrashed()
39
    {
40 1
        $this->methods[] = new Method(__FUNCTION__);
41
42 1
        return $this;
43
    }
44
}
45