Completed
Pull Request — master (#293)
by Nic
07:32
created

FoxyStripeProductFormFieldExtension   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 17
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateAttributes() 0 9 3
1
<?php
2
3
/**
4
 * Class FoxyStripeProductFormFieldExtension
5
 */
6
class FoxyStripeProductFormFieldExtension extends DataExtension
7
{
8
9
    /**
10
     * @param $attributes
11
     */
12
    public function updateAttributes(&$attributes)
13
    {
14
        if (Controller::curr()->data()->Classname == 'DonationProduct') {
15
            if (preg_match('/^(product_id)/', $this->owner->getName())) {
16
                $attributes['h:name'] = $attributes['name'];
17
                unset($attributes['name']);
18
            }
19
        }
20
    }
21
22
}