BlogCommentExtension   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getExtraClass() 0 12 3
1
<?php
2
3
namespace SilverStripe\Blog\Model;
4
5
use SilverStripe\ORM\DataExtension;
6
7
/**
8
 * Adds Blog specific behaviour to Comment.
9
 */
10
class BlogCommentExtension extends DataExtension
11
{
12
    /**
13
     * Extra CSS classes for styling different comment types.
14
     *
15
     * @return string
16
     */
17
    public function getExtraClass()
18
    {
19
        $blogPost = $this->owner->getParent();
20
21
        if ($blogPost instanceof BlogPost) {
22
            if ($blogPost->isAuthor($this->owner->Author())) {
23
                return 'author-comment';
24
            }
25
        }
26
27
        return '';
28
    }
29
}
30