Form   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 17
c 1
b 0
f 1
dl 0
loc 44
ccs 0
cts 21
cp 0
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A processValidation() 0 5 1
A process() 0 11 1
A getDataFromModel() 0 7 2
A initElements() 0 7 1
1
<?php
2
3
namespace ByTIC\Payments\Gateways\Providers\Paylike;
4
5
use ByTIC\Payments\Gateways\Providers\AbstractGateway\Form as AbstractForm;
6
use ByTIC\Payments\Models\Methods\Types\CreditCards;
7
8
/**
9
 * Class Form
10
 * @package ByTIC\Payments\Gateways\Providers\Paylike
11
 */
12
class Form extends AbstractForm
13
{
14
    public function initElements()
15
    {
16
        parent::initElements();
17
        $this->initElementSandbox();
18
19
        $this->addInput('public_key', 'Public key', false);
20
        $this->addInput('private_key', 'Private key', false);
21
    }
22
23
    public function getDataFromModel()
24
    {
25
        $type = $this->getForm()->getModel()->getType();
26
        if ($type instanceof CreditCards) {
27
            $type->getGateway();
28
        }
29
        parent::getDataFromModel();
30
    }
31
32
    /**
33
     * @return bool
34
     */
35
    public function processValidation()
36
    {
37
        parent::processValidation();
38
39
        return true;
40
    }
41
42
    /**
43
     * @return bool
44
     */
45
    public function process()
46
    {
47
        parent::process();
48
49
        $model = $this->getForm()->getModel();
50
        $options = $model->getPaymentGatewayOptions();
51
52
        $model->setPaymentGatewayOptions($options);
53
        $model->saveRecord();
54
55
        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...
56
    }
57
}
58