PageEditsInLastYear   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 9
c 1
b 0
f 0
dl 0
loc 19
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getCalculatedAnswer() 0 9 2
A nameSpacesRequired() 0 4 1
1
<?php
2
3
namespace Sunnysideup\HealthCheckProvider\Checks\Content;
4
5
use SilverStripe\ORM\DB;
6
use Sunnysideup\HealthCheckProvider\Checks\HealthCheckItemRunner;
7
8
class PageEditsInLastYear extends HealthCheckItemRunner
9
{
10
    private static $limit = 3;
0 ignored issues
show
introduced by
The private property $limit is not used, and could be removed.
Loading history...
11
12
    public function getCalculatedAnswer(): array
13
    {
14
        $returnArray = [];
15
        $rows = DB::query('SELECT unix_timestamp(LastEdited) as A FROM SiteTree_Versions');
16
        foreach ($rows as $row) {
17
            $returnArray[] = $row['A'];
18
        }
19
20
        return $returnArray;
21
    }
22
23
    protected function nameSpacesRequired(): array
24
    {
25
        return [
26
            'SilverStripe\\Reports',
27
        ];
28
    }
29
}
30