Code Duplication    Length = 19-19 lines in 2 locations

code/model/UpdateNote.php 2 locations

@@ 148-166 (lines=19) @@
145
            $fields->removeFieldFromTab('Root.Main', 'UpdatedByID');
146
            $who = $this->UpdatedBy();
147
            if ($who && $who->exists()) {
148
                if ($who->hasMethod('CMSEditLink')) {
149
                    $fields->addFieldToTab(
150
                        'Root.Main',
151
                        $whoField = ReadonlyField::create(
152
                            'UpdatedByLink',
153
                            $fieldLabels['UpdatedBy'],
154
                            '<h2><a href="'.$who->CMSEditLink().'" target="_blank">'.$who->getTitle().'</a></h2>'
155
                        )
156
                    );
157
                } else {
158
                    $fields->addFieldToTab(
159
                        'Root.Main',
160
                        $whoField = ReadonlyField::create(
161
                            'UpdatedByLink',
162
                            $fieldLabels['UpdatedBy'],
163
                            '<h2>'.$who->getTitle().'.</h2>'
164
                        )
165
                    );
166
                }
167
            } else {
168
                $fields->addFieldToTab(
169
                    'Root.Main',
@@ 181-199 (lines=19) @@
178
        }
179
180
        if ($parent = $this->getParent()) {
181
            if ($parent->hasMethod('CMSEditLink')) {
182
                $fields->addFieldToTab(
183
                    'Root.Main',
184
                    $parentField = ReadonlyField::create(
185
                        'ParentLink',
186
                        $fieldLabels['UpdateNoteRecord'],
187
                        '<h2><a href="'.$parent->CMSEditLink().'" target="_blank">'.$parent->getTitle().'</a></h2>'
188
                    )
189
                );
190
            } else {
191
                $fields->addFieldToTab(
192
                    'Root.Main',
193
                    $parentField = ReadonlyField::create(
194
                        'ParentLink',
195
                        $fieldLabels['UpdateNoteRecord'],
196
                        '<h2>'.$parent->getTitle().'</h2>'
197
                    )
198
                );
199
            }
200
            $parentField->dontEscape = true;
201
        }
202
        return $fields;