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

updateAttributes()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 8
cp 0
rs 9.6666
c 0
b 0
f 0
cc 3
eloc 5
nc 3
nop 1
crap 12
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
}