Code Duplication    Length = 8-8 lines in 3 locations

Bundle/CoreBundle/Form/WidgetType.php 1 location

@@ 34-41 (lines=8) @@
31
        $businessEntityId = $options['businessEntityId'];
32
        $mode = $options['mode'];
33
34
        if ($businessEntityId !== null) {
35
            if ($namespace === null) {
36
                throw new \Exception('The namespace is mandatory if the business_entity_id is given.');
37
            }
38
            if ($mode === null) {
39
                throw new \Exception('The mode is mandatory if the business_entity_id is given.');
40
            }
41
        }
42
43
        //if no mode is specified, the static is used by default
44
        if ($mode === null) {

Bundle/WidgetBundle/Builder/WidgetFormBuilder.php 2 locations

@@ 161-168 (lines=8) @@
158
        $router = $this->container->get('router');
159
160
        //test parameters
161
        if ($businessEntityId !== null) {
162
            if ($namespace === null) {
163
                throw new \Exception('The namespace is mandatory if the businessEntityId is given');
164
            }
165
            if ($formMode === null) {
166
                throw new \Exception('The formMode is mandatory if the businessEntityId is given');
167
            }
168
        }
169
170
        $container = $this->container;
171
        $formFactory = $container->get('form.factory');
@@ 247-254 (lines=8) @@
244
    public function buildForm($widget, View $view, $businessEntityId = null, $namespace = null, $formMode = Widget::MODE_STATIC, $slotId = null, $position = null, $parentWidgetMap = null)
245
    {
246
        //test parameters
247
        if ($businessEntityId !== null) {
248
            if ($namespace === null) {
249
                throw new \Exception('The namespace is mandatory if the businessEntityId is given');
250
            }
251
            if ($formMode === null) {
252
                throw new \Exception('The formMode is mandatory if the businessEntityId is given');
253
            }
254
        }
255
256
        $form = $this->buildWidgetForm($widget, $view, $businessEntityId, $namespace, $formMode, $position, $parentWidgetMap, $slotId);
257