Completed
Push — develop ( edb8bf...6f43a0 )
by Nate
08:26
created

CreateProviderInstance   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A newRecord() 0 12 2
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://flipboxfactory.com/software/patron/license
6
 * @link       https://www.flipboxfactory.com/software/patron/
7
 */
8
9
namespace flipbox\patron\actions\provider;
10
11
use flipbox\craft\ember\actions\records\CreateRecord;
12
use flipbox\patron\records\Provider;
13
use flipbox\patron\records\ProviderInstance;
14
use yii\db\ActiveRecord;
15
16
/**
17
 * @author Flipbox Factory <[email protected]>
18
 * @since 1.0.0
19
 */
20
class CreateProviderInstance extends CreateRecord
0 ignored issues
show
Bug introduced by
There is at least one abstract method in this class. Maybe declare it as abstract, or implement the remaining methods: performAction, validBodyParams
Loading history...
21
{
22
    /**
23
     * @inheritdoc
24
     */
25
    public $validBodyParams = [
26
        'provider',
27
        'clientId',
28
        'clientSecret',
29
        'settings',
30
        'environments'
31
    ];
32
33
    /**
34
     * @inheritdoc
35
     * @return Provider
36
     */
37
    protected function newRecord(array $config = []): ActiveRecord
38
    {
39
        /** @var ProviderInstance $record */
40
        $record = new ProviderInstance();
41
42
        // Do we need to set properties too
43
        if (!empty($config)) {
44
            $record->setAttributes($config);
45
        }
46
47
        return $record;
48
    }
49
}
50