Passed
Push — master ( 231fe1...5105bf )
by Gabriel
05:58
created

Form::initElements()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 8
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 14
ccs 0
cts 9
cp 0
crap 2
rs 10
1
<?php
2
3
namespace ByTIC\Payments\Gateways\Providers\PlatiOnline;
4
5
use ByTIC\Payments\Gateways\Providers\AbstractGateway\Form as AbstractForm;
6
use ByTIC\Payments\Models\Methods\Types\CreditCards;
7
use Symfony\Component\HttpFoundation\File\UploadedFile;
8
9
/**
10
 * Class Form
11
 * @package ByTIC\Payments\Gateways\Providers\PlatiOnline
12
 */
13
class Form extends AbstractForm
14
{
15
    public function initElements()
16
    {
17
        parent::initElements();
18
        $this->initElementSandbox();
19
20
        $this->addInput('loginId', 'Login ID', true);
21
        $this->addInput('website', 'Website', true);
22
23
        $this->addInput('initialVector', 'Initial Vector', true);
24
        $this->addInput('initialVectorItsn', 'Initial Vector Itsn', true);
25
26
        $this->addTextarea('publicKey', 'Public Key', true);
27
28
        $this->addTextarea('privateKey', 'Private key', true);
29
    }
30
31
    public function getDataFromModel()
32
    {
33
        $type = $this->getForm()->getModel()->getType();
34
        if ($type instanceof CreditCards) {
0 ignored issues
show
introduced by
$type is never a sub-type of ByTIC\Payments\Models\Methods\Types\CreditCards.
Loading history...
35
            $type->getGateway();
36
        }
37
        parent::getDataFromModel();
38
    }
39
40
    /**
41
     * @return bool
42
     */
43
    public function process()
44
    {
45
        parent::process();
46
47
        $model = $this->getForm()->getModel();
48
        $options = $model->getPaymentGatewayOptions();
49
        $model->setPaymentGatewayOptions($options);
50
        $model->saveRecord();
51
52
        return $options;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $options returns the type Nip_Form which is incompatible with the documented return type boolean.
Loading history...
53
    }
54
}
55