PaymentType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 20 1
A getName() 0 4 1
1
<?php
2
3
/**
4
 * @author Rafał Muszyński <[email protected]>
5
 * @copyright 2015 Sourcefabric z.ú.
6
 * @license http://www.gnu.org/licenses/gpl-3.0.txt
7
 */
8
namespace Newscoop\PaywallBundle\Form\Type;
9
10
use Symfony\Component\Form\AbstractType;
11
use Symfony\Component\Form\FormBuilderInterface;
12
use Newscoop\PaywallBundle\Entity\PaymentInterface;
13
14
/**
15
 * Payment form type.
16
 */
17
class PaymentType extends AbstractType
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function buildForm(FormBuilderInterface $builder, array $options)
23
    {
24
        $builder
25
            ->add('amount', 'money', array(
26
                'label' => 'paywall.label.total',
27
                'precision' => 2,
28
                'currency' => false,
29
            ))
30
            ->add('state', 'choice', array(
31
                'label' => 'paywall.step2.label.active',
32
                'choices' => array(
33
                    PaymentInterface::STATE_FAILED => 'paywall.form.payment.state.failed',
34
                    PaymentInterface::STATE_COMPLETED => 'paywall.form.payment.state.completed',
35
                    PaymentInterface::STATE_NEW => 'paywall.form.payment.state.new',
36
                    PaymentInterface::STATE_PENDING => 'paywall.form.payment.state.pending',
37
                    PaymentInterface::STATE_CANCELLED => 'paywall.form.payment.state.cancelled',
38
                    PaymentInterface::STATE_UNKNOWN => 'paywall.form.payment.state.unknown',
39
                ),
40
            ));
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function getName()
47
    {
48
        return 'paywall_payment';
49
    }
50
}
51