MoneyFieldset   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 1 Features 0
Metric Value
wmc 2
c 4
b 1
f 0
lcom 0
cbo 1
dl 0
loc 35
ccs 18
cts 18
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getInputFilterSpecification() 0 4 1
A init() 0 21 1
1
<?php
2
3
namespace ZFBrasil\DoctrineMoneyModule\Form;
4
5
use Zend\Form\Element\Number;
6
use Zend\Form\Fieldset;
7
use Zend\InputFilter\InputFilterProviderInterface;
8
use ZFBrasil\DoctrineMoneyModule\Form\Element\CurrencySelect;
9
use ZFBrasil\DoctrineMoneyModule\InputFilter\MoneyInputFilter;
10
11
/**
12
 * Money form element that will make it very easy to work with money and currencies.
13
 *
14
 * @author Fábio Carneiro <[email protected]>
15
 * @license MIT
16
 */
17
class MoneyFieldset extends Fieldset implements InputFilterProviderInterface
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22 3
    public function init()
23
    {
24 3
        $this->add([
25 3
            'type' => Number::class,
26 3
            'name' => 'amount',
27
            'options' => [
28 3
                'label' => 'Amount',
29 3
            ],
30
            'attributes' => [
31 3
                'step' => '0.01',
32 3
            ],
33 3
        ]);
34
35 3
        $this->add([
36 3
            'type' => CurrencySelect::class,
37 3
            'name' => 'currency',
38
            'options' => [
39 3
                'label' => 'Currency',
40 3
            ],
41 3
        ]);
42 3
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47 3
    public function getInputFilterSpecification()
48
    {
49 3
        return ['type' => MoneyInputFilter::class];
50
    }
51
}
52