Completed
Push — master ( 747147...fabbdf )
by Paweł
10:47
created

configureOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Bundle\CoreBundle\Form\Type\Shipping\Calculator;
13
14
use Sylius\Bundle\CoreBundle\Form\Type\ChannelCollectionType;
15
use Sylius\Bundle\ShippingBundle\Form\Type\Calculator\PerUnitRateConfigurationType;
16
use Sylius\Component\Core\Model\ChannelInterface;
17
use Symfony\Component\Form\AbstractType;
18
use Symfony\Component\OptionsResolver\OptionsResolver;
19
20
/**
21
 * @author Grzegorz Sadowski <[email protected]>
22
 */
23
final class ChannelBasedPerUnitRateConfigurationType extends AbstractType
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function configureOptions(OptionsResolver $resolver)
29
    {
30
        $resolver->setDefaults([
31
            'entry_type' => PerUnitRateConfigurationType::class,
32
            'entry_options' => function (ChannelInterface $channel) {
33
                return [
34
                    'label' => $channel->getName(),
35
                    'currency' => $channel->getBaseCurrency()->getCode(),
36
                ];
37
            },
38
        ]);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function getParent()
45
    {
46
        return ChannelCollectionType::class;
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getBlockPrefix()
53
    {
54
        return 'sylius_channel_based_shipping_calculator_per_unit_rate';
55
    }
56
}
57