Completed
Push — master ( 9dfdce...c53712 )
by Paweł
26s
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\PromotionBundle\Form\Type\Rule;
13
14
use Sylius\Bundle\CoreBundle\Form\Type\ChannelCollectionType;
15
use Sylius\Component\Core\Model\ChannelInterface;
16
use Symfony\Component\Form\AbstractType;
17
use Symfony\Component\OptionsResolver\OptionsResolver;
18
19
/**
20
 * @author Kamil Kokot <[email protected]>
21
 */
22
final class ChannelBasedItemTotalConfigurationType extends AbstractType
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function configureOptions(OptionsResolver $resolver)
28
    {
29
        $resolver->setDefaults([
30
            'entry_type' => ItemTotalConfigurationType::class,
31
            'entry_options' => function (ChannelInterface $channel) {
32
                return [
33
                    'label' => $channel->getName(),
34
                    'currency' => $channel->getBaseCurrency()->getCode(),
35
                ];
36
            },
37
        ]);
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function getParent()
44
    {
45
        return ChannelCollectionType::class;
46
    }
47
}
48