WidgetExtensionFormBuilder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 22
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A onSavingConfiguration() 0 15 2
1
<?php namespace Anomaly\DashboardModule\Widget\Extension\Form;
2
3
use Anomaly\ConfigurationModule\Configuration\Form\ConfigurationFormBuilder;
4
use Anomaly\DashboardModule\Widget\Contract\WidgetInterface;
5
use Anomaly\DashboardModule\Widget\Form\WidgetFormBuilder;
6
use Anomaly\Streams\Platform\Ui\Form\Multiple\MultipleFormBuilder;
7
8
/**
9
 * Class WidgetExtensionFormBuilder
10
 *
11
 * @link          http://pyrocms.com/
12
 * @author        PyroCMS, Inc. <[email protected]>
13
 * @author        Ryan Thompson <[email protected]>
14
 */
15
class WidgetExtensionFormBuilder extends MultipleFormBuilder
16
{
17
18
    /**
19
     * Fired just before saving the configuration.
20
     */
21
    public function onSavingConfiguration()
22
    {
23
        /* @var WidgetFormBuilder $form */
24
        $form = $this->forms->get('widget');
25
26
        /* @var WidgetInterface $widget */
27
        $widget = $form->getFormEntry();
28
29
        /* @var ConfigurationFormBuilder $configuration */
30
        $configuration = $this->forms->get('configuration');
31
32
        if (!$configuration->getScope()) {
33
            $configuration->setScope($widget->getId());
34
        }
35
    }
36
}
37