GridFieldExtension   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateNewRowClasses() 0 4 2
1
<?php
2
/**
3
 * class GridFieldExtension|Firesphere\SearchBackend\Extensions\GridFieldExtension Add colours to the GridField
4
 *
5
 * @package Firesphere\Search\Backend
6
 * @author Simon `Firesphere` Erkelens; Marco `Sheepy` Hermo
7
 * @copyright Copyright (c) 2018 - now() Firesphere & Sheepy
8
 */
9
10
namespace Firesphere\SearchBackend\Extensions;
11
12
use Firesphere\SearchBackend\Models\SearchLog;
13
use SilverStripe\Core\Extension;
14
use SilverStripe\Forms\GridField\GridField;
15
use SilverStripe\ORM\DataObject;
16
use SilverStripe\View\ViewableData;
17
18
/**
19
 * Class GridFieldExtension
20
 * Dirty hack to get the alert/warning/info classes in to the gridfield
21
 *
22
 * @property GridField|GridFieldExtension $owner
23
 */
24
class GridFieldExtension extends Extension
25
{
26
    /**
27
     * Add the visibility classes to the GridField
28
     *
29
     * @param array $classes
30
     * @param int $total
31
     * @param string $index
32
     * @param DataObject $record
33
     */
34
    public function updateNewRowClasses(array &$classes, int $total, string $index, ViewableData $record)
0 ignored issues
show
Unused Code introduced by
The parameter $index is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

34
    public function updateNewRowClasses(array &$classes, int $total, /** @scrutinizer ignore-unused */ string $index, ViewableData $record)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $total is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

34
    public function updateNewRowClasses(array &$classes, /** @scrutinizer ignore-unused */ int $total, string $index, ViewableData $record)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
    {
36
        if ($record instanceof SearchLog) {
37
            $classes[] = $record->getExtraClass();
38
        }
39
    }
40
}
41