AlsoPurchasedBoxConfigurator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 26
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getType() 0 4 1
A addFormFields() 0 13 1
1
<?php
2
/**
3
 * WellCommerce Open-Source E-Commerce Platform
4
 *
5
 * This file is part of the WellCommerce package.
6
 *
7
 * (c) Adam Piotrowski <[email protected]>
8
 *
9
 * For the full copyright and license information,
10
 * please view the LICENSE file that was distributed with this source code.
11
 */
12
13
namespace WellCommerce\Bundle\AlsoPurchasedBundle\Service\Layout\Configurator;
14
15
use WellCommerce\Bundle\AlsoPurchasedBundle\Controller\Box\AlsoPurchasedBoxController;
16
use WellCommerce\Bundle\CoreBundle\Layout\Configurator\AbstractLayoutBoxConfigurator;
17
use WellCommerce\Component\Form\Elements\FormInterface;
18
use WellCommerce\Component\Form\FormBuilderInterface;
19
20
/**
21
 * Class LastViewedBoxConfigurator
22
 *
23
 * @author  Adam Piotrowski <[email protected]>
24
 */
25
final class AlsoPurchasedBoxConfigurator extends AbstractLayoutBoxConfigurator
26
{
27
    public function __construct(AlsoPurchasedBoxController $controller)
28
    {
29
        $this->controller = $controller;
30
    }
31
    
32
    public function getType(): string
33
    {
34
        return 'AlsoPurchased';
35
    }
36
    
37
    public function addFormFields(FormBuilderInterface $builder, FormInterface $form, $defaults)
38
    {
39
        $fieldset = $this->getFieldset($builder, $form);
40
        
41
        $fieldset->addChild($builder->getElement('tip', [
42
            'tip' => 'layout_box.tip.also_purchased',
43
        ]));
44
        
45
        $fieldset->addChild($builder->getElement('text_field', [
46
            'name'  => 'limit',
47
            'label' => 'layout_box.label.also_purchased.limit',
48
        ]))->setValue($this->getValue($defaults, '[limit]', 4));
49
    }
50
}
51