CommentReplyMessage   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 26.09 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 6
loc 23
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A message() 6 6 2
A __construct() 0 2 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Mamaduka\BpNotifications\Messages;
4
5
class CommentReplyMessage extends UpdateReplyMessage {
6
7
	/**
8
	 * Create a new message instance.
9
	 *
10
	 * @param array $data
11
	 * @return void
12
	 */
13 1
	public function __construct( array $data = [] ) {
14 1
		parent::__construct( $data );
15 1
	}
16
17
	/**
18
	 * Get message text.
19
	 *
20
	 * @return string
21
	 */
22 2 View Code Duplication
	public function message() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23 2
		if ( $this->data['total'] > 1 ) {
24 1
			return sprintf( 'You have %1$d new comment replies', (int) $this->data['total'] );
25
		}
26
27 1
		return sprintf( '%1$s replied to one your activity comments', bp_core_get_user_displayname( $this->data['user_id' ] ) );
0 ignored issues
show
Bug introduced by
The function bp_core_get_user_displayname was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

27
		return sprintf( '%1$s replied to one your activity comments', /** @scrutinizer ignore-call */ bp_core_get_user_displayname( $this->data['user_id' ] ) );
Loading history...
28
	}
29
}
30