Passed
Branch master (79d24d)
by Johannes
03:19
created

MergeableClassMetadata::merge()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 16
rs 9.4285
cc 3
eloc 10
nc 3
nop 1
1
<?php
2
3
namespace Metadata;
4
5
class MergeableClassMetadata extends ClassMetadata implements MergeableInterface
0 ignored issues
show
introduced by
Copyright notice missing
Loading history...
introduced by
Missing class doc comment
Loading history...
6
{
7
    public function merge(MergeableInterface $object)
0 ignored issues
show
introduced by
This function must always have a return value.
Loading history...
introduced by
Missing function doc comment
Loading history...
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
8
    {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
9
        if (!$object instanceof MergeableClassMetadata) {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
10
            throw new \InvalidArgumentException('$object must be an instance of MergeableClassMetadata.');
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
11
        }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
12
13
        $this->name = $object->name;
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
14
        $this->reflection = $object->reflection;
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
15
        $this->methodMetadata = array_merge($this->methodMetadata, $object->methodMetadata);
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
16
        $this->propertyMetadata = array_merge($this->propertyMetadata, $object->propertyMetadata);
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
17
        $this->fileResources = array_merge($this->fileResources, $object->fileResources);
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
18
19
        if ($object->createdAt < $this->createdAt) {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
20
            $this->createdAt = $object->createdAt;
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
21
        }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
22
    }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
23
}