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

MergeableClassMetadata   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 19
wmc 3
lcom 1
cbo 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A merge() 0 16 3
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
}