NoImageProducts   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A sort() 0 3 1
A columns() 0 6 1
A group() 0 3 1
A sourceRecords() 0 3 1
A title() 0 3 1
1
<?php
2
3
namespace SilverShop\Reports\SideReport;
4
5
use SilverShop\Page\Product;
6
use SilverStripe\Reports\Report;
7
8
class NoImageProducts extends Report
9
{
10
    public function title()
11
    {
12
        return _t('SilverShop\Reports\SideReport.NoImage', 'Products with no image');
13
    }
14
15
    public function group()
16
    {
17
        return _t('SilverShop\Reports\SideReport.ShopGroup', 'Shop');
18
    }
19
20
    public function sort()
21
    {
22
        return 0;
23
    }
24
25
    public function sourceRecords($params = null)
26
    {
27
        return Product::get()->filter('ImageID', 0)->sort('Title', 'ASC');
28
    }
29
30
    public function columns()
31
    {
32
        return [
33
            'Title' => [
34
                'title' => 'Title',
35
                'link' => true,
36
            ],
37
        ];
38
    }
39
}
40