Code Duplication    Length = 15-16 lines in 2 locations

code/Calendar.php 2 locations

@@ 227-241 (lines=15) @@
224
225
    // Field Functions
226
227
    public function addViews($views)
228
    {
229
        if (! is_array($views)) {
230
            $views = array($views);
231
        }
232
        foreach ($views as $view) {
233
            if (is_a($view, 'CalendarAbstractView')) {
234
                if (! in_array($view, $this->views)) {
235
                    $this->views[] = $view;
236
                }
237
            } else {
238
                user_error('Calendar::addViews() : you cannot add a view which class does not extend \'CalendarAbstractView\'', E_USER_ERROR);
239
            }
240
        }
241
    }
242
243
    private function getView($viewName)
244
    {
@@ 252-267 (lines=16) @@
249
        }
250
    }
251
252
    public function removeViews($views)
253
    {
254
        if (! is_array($views)) {
255
            $views = array($views);
256
        }
257
        foreach ($views as $view) {
258
            if (is_a($view, 'CalendarAbstractView')) {
259
                $index = array_search($view, $this->views);
260
                if ($index) {
261
                    unset($this->views[$index]);
262
                }
263
            } else {
264
                user_error('Calendar::removeViews() : you cannot remove a view which class does not extend \'CalendarAbstractView\'', E_USER_ERROR);
265
            }
266
        }
267
    }
268
269
    public function forTemplate()
270
    {