Completed
Push — master ( 738b67...b891e0 )
by Kamil
03:42 queued 03:07
created

getParent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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
declare(strict_types=1);
13
14
namespace Sylius\Bundle\CoreBundle\Form\Type\Promotion\Rule;
15
16
use Sylius\Bundle\CoreBundle\Form\Type\ChannelCollectionType;
17
use Sylius\Bundle\PromotionBundle\Form\Type\Rule\ItemTotalConfigurationType;
18
use Sylius\Component\Core\Model\ChannelInterface;
19
use Symfony\Component\Form\AbstractType;
20
use Symfony\Component\OptionsResolver\OptionsResolver;
21
22
/**
23
 * @author Kamil Kokot <[email protected]>
24
 */
25
final class ChannelBasedItemTotalConfigurationType extends AbstractType
26
{
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function configureOptions(OptionsResolver $resolver): void
31
    {
32
        $resolver->setDefaults([
33
            'entry_type' => ItemTotalConfigurationType::class,
34
            'entry_options' => function (ChannelInterface $channel) {
35
                return [
36
                    'label' => $channel->getName(),
37
                    'currency' => $channel->getBaseCurrency()->getCode(),
38
                ];
39
            },
40
        ]);
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function getParent(): string
47
    {
48
        return ChannelCollectionType::class;
49
    }
50
}
51