Code Duplication    Length = 15-17 lines in 2 locations

tests/Doctrine/Tests/ORM/Functional/NotifyPolicyTest.php 1 location

@@ 93-107 (lines=15) @@
90
    }
91
}
92
93
class NotifyBaseEntity implements NotifyPropertyChanged {
94
    public $listeners = [];
95
96
    public function addPropertyChangedListener(PropertyChangedListener $listener) {
97
        $this->listeners[] = $listener;
98
    }
99
100
    protected function onPropertyChanged($propName, $oldValue, $newValue) {
101
        if ($this->listeners) {
102
            foreach ($this->listeners as $listener) {
103
                $listener->propertyChanged($this, $propName, $oldValue, $newValue);
104
            }
105
        }
106
    }
107
}
108
109
/** @Entity @ChangeTrackingPolicy("NOTIFY") */
110
class NotifyUser extends NotifyBaseEntity {

tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1690Test.php 1 location

@@ 76-92 (lines=17) @@
73
    }
74
}
75
76
class NotifyBaseEntity implements NotifyPropertyChanged {
77
    public $listeners = [];
78
79
    public function addPropertyChangedListener(PropertyChangedListener $listener) {
80
        if (!in_array($listener, $this->listeners)) {
81
            $this->listeners[] = $listener;
82
        }
83
    }
84
85
    protected function onPropertyChanged($propName, $oldValue, $newValue) {
86
        if ($this->listeners) {
87
            foreach ($this->listeners as $listener) {
88
                $listener->propertyChanged($this, $propName, $oldValue, $newValue);
89
            }
90
        }
91
    }
92
}
93
94
/** @Entity @ChangeTrackingPolicy("NOTIFY") */
95
class DDC1690Parent extends NotifyBaseEntity {