HistoryControllerFactoryExtension   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
c 2
b 0
f 0
dl 0
loc 12
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateIsEnabled() 0 10 3
1
<?php
2
3
namespace SilverStripe\VersionedAdmin\Tests\Controller\HistoryControllerFactory;
4
5
use SilverStripe\Core\Extension;
6
use SilverStripe\Dev\TestOnly;
7
8
class HistoryControllerFactoryExtension extends Extension implements TestOnly
9
{
10
    public function updateIsEnabled($record)
11
    {
12
        // First fixture is explicitely disable (from HistoryControllerFactoryTest.yml)
13
        if ($record->Title === '1') {
14
            return false;
15
        }
16
17
        // second fixture is explicitely enable (from HistoryControllerFactoryTest.yml)
18
        if ($record->Title === '2') {
19
            return true;
20
        }
21
    }
22
}
23