Code Duplication    Length = 12-13 lines in 6 locations

lib/midcom/admin/folder/handler/edit.php 1 location

@@ 129-141 (lines=13) @@
126
    /**
127
     * DM2 creation callback, binds to the current content topic.
128
     */
129
    function & dm2_create_callback (&$controller)
130
    {
131
        $this->_new_topic = new midcom_db_topic();
132
        $this->_new_topic->up = $this->_topic->id;
133
134
        if (! $this->_new_topic->create())
135
        {
136
            debug_print_r('We operated on this object:', $this->_new_topic);
137
            throw new midcom_error('Failed to create a new topic, cannot continue. Last Midgard error was: '. midcom_connection::get_error_string());
138
        }
139
140
        return $this->_new_topic;
141
    }
142
143
    /**
144
     * Handler for folder editing. Checks for the permissions and folder integrity.

lib/net/nehmer/blog/handler/link.php 1 location

@@ 66-78 (lines=13) @@
63
    /**
64
     * DM2 creation callback, binds to the current content topic.
65
     */
66
    public function &dm2_create_callback (&$controller)
67
    {
68
        $this->_link = new net_nehmer_blog_link_dba();
69
        $this->_link->topic = $this->_topic->id;
70
71
        if (!$this->_link->create())
72
        {
73
            debug_print_r('We operated on this object:', $this->_link);
74
            throw new midcom_error('Failed to create a new article. Last Midgard error was: '. midcom_connection::get_error_string());
75
        }
76
77
        return $this->_link;
78
    }
79
80
    /**
81
     * Displays an article edit view.

lib/net/nehmer/static/handler/link.php 1 location

@@ 61-73 (lines=13) @@
58
    /**
59
     * DM2 creation callback, binds to the current content topic.
60
     */
61
    public function &dm2_create_callback (&$controller)
62
    {
63
        $this->_link = new net_nehmer_static_link_dba();
64
        $this->_link->topic = $this->_topic->id;
65
66
        if (!$this->_link->create())
67
        {
68
            debug_print_r('We operated on this object:', $this->_link);
69
            throw new midcom_error('Failed to create a new article. Last Midgard error was: '. midcom_connection::get_error_string());
70
        }
71
72
        return $this->_link;
73
    }
74
75
    /**
76
     * {@inheritDoc}

lib/org/openpsa/calendar/handler/create.php 1 location

@@ 68-79 (lines=12) @@
65
    /**
66
     * DM2 creation callback, binds to the current content topic.
67
     */
68
    public function & dm2_create_callback (&$controller)
69
    {
70
        $this->_event = new org_openpsa_calendar_event_dba();
71
        $this->_event->up = $this->_root_event->id;
72
        if (!$this->_event->create())
73
        {
74
            debug_print_r('We operated on this object:', $this->_event);
75
            throw new midcom_error('Failed to create a new event. Last Midgard error was: ' . midcom_connection::get_error_string());
76
        }
77
78
        return $this->_event;
79
    }
80
81
    /**
82
     * Handle the creation phase

lib/org/openpsa/directmarketing/handler/campaign/create.php 1 location

@@ 59-71 (lines=13) @@
56
    /**
57
     * DM2 creation callback, binds to the current content topic.
58
     */
59
    public function & dm2_create_callback (&$controller)
60
    {
61
        $this->_campaign = new org_openpsa_directmarketing_campaign_dba();
62
        $this->_campaign->node = $this->_topic->id;
63
64
        if (! $this->_campaign->create())
65
        {
66
            debug_print_r('We operated on this object:', $this->_campaign);
67
            throw new midcom_error('Failed to create a new campaign. Last Midgard error was: ' . midcom_connection::get_error_string());
68
        }
69
70
        return $this->_campaign;
71
    }
72
73
    /**
74
     * Displays an campaign edit view.

lib/org/openpsa/products/handler/group/create.php 1 location

@@ 69-81 (lines=13) @@
66
    /**
67
     * DM2 creation callback, binds to the current content topic.
68
     */
69
    public function & dm2_create_callback (&$controller)
70
    {
71
        $this->_group = new org_openpsa_products_product_group_dba();
72
        $this->_group->up = $this->_request_data['up'];
73
74
        if (! $this->_group->create())
75
        {
76
            debug_print_r('We operated on this object:', $this->_group);
77
            throw new midcom_error('Failed to create a new product group. Last Midgard error was: ' . midcom_connection::get_error_string());
78
        }
79
80
        return $this->_group;
81
    }
82
83
    /**
84
     * Displays an group create view.