SoftDeletingScope   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
dl 0
loc 38
ccs 6
cts 9
cp 0.6667
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A withTrashed() 0 6 1
A withoutTrashed() 0 6 1
A onlyTrashed() 0 6 1
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