Completed
Pull Request — master (#185)
by Janne
03:01
created

CommentsGridField   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 3
c 3
b 0
f 1
lcom 0
cbo 2
dl 0
loc 22
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A newRow() 0 16 3
1
<?php
2
3
class CommentsGridField extends GridField
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
{
5
    /**
6
     * {@inheritdoc}
7
     */
8
    protected function newRow($total, $index, $record, $attributes, $content)
9
    {
10
        if (!isset($attributes['class'])) {
11
            $attributes['class'] = '';
12
        }
13
14
        if ($record->IsSpam) {
15
            $attributes['class'] .= ' spam';
16
        }
17
18
        return FormField::create_tag(
19
            'tr',
20
            $attributes,
21
            $content
22
        );
23
    }
24
}
25