MapperModification::testModification()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 4
1
<?php
2
3
namespace Dynamic\Salsify\Tests\TestOnly;
4
5
use SilverStripe\Core\Extension;
6
use SilverStripe\Dev\TestOnly;
7
8
/**
9
 * Class MapperModification
10
 * @package Dynamic\Salsify\Tests\TestOnly
11
 */
12
class MapperModification extends Extension implements TestOnly
13
{
14
    /**
15
     * @param string|\SilverStripe\ORM\DataObject $class
16
     * @param string $dbField
17
     * @param array $config
18
     * @param array $data
19
     * @return array
20
     */
21
    public function testModification($class, $dbField, $config, $data)
22
    {
23
        $salsifyField = $config['salsifyField'];
24
        if (array_key_exists($salsifyField, $data)) {
25
            $data[$salsifyField] = $data[$salsifyField] . ' TEST_MOD';
26
        }
27
        return $data;
28
    }
29
}
30