Completed
Pull Request — master (#43)
by Jose Manuel
02:54
created

MutationObjectHandler   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 19
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A hasChanged() 0 16 5
1
<?php
2
3
namespace Softonic\GraphQL\DataObjects\Mutation\Traits;
4
5
use Softonic\GraphQL\DataObjects\Mutation\MutationObject;
6
7
trait MutationObjectHandler
8
{
9 56
    public function hasChanged(): bool
10
    {
11 56
        if ($this->hasChanged) {
0 ignored issues
show
Bug introduced by
The property hasChanged 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...
12 52
            return true;
13
        }
14
15 48
        foreach ($this->arguments as $argument) {
0 ignored issues
show
Bug introduced by
The property arguments 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...
16 48
            if ($argument instanceof MutationObject && $argument->hasChanged()) {
17 44
                $this->hasChanged = true;
18
19 44
                return true;
20
            }
21
        }
22
23 24
        return false;
24
    }
25
}
26