Completed
Push — master ( f9651b...451a88 )
by Matt
30s queued 13s
created

alert   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 52.17 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 12
loc 23
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 12 12 2

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
 *
4
 * Advertisement management. An extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) 2017 phpBB Limited <https://www.phpbb.com>
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace phpbb\ads\analyser\test;
12
13
class alert implements test_interface
14
{
15
	/**
16
	 * {@inheritDoc}
17
	 *
18
	 * Javascript alert() test.
19
	 * This test checks for the presence of alert() in an ad code.
20
	 * There is no reason why ad would trigger alert, so it's
21
	 * categorized as warning.
22
	 */
23 13 View Code Duplication
	public function run($ad_code)
1 ignored issue
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...
24
	{
25 13
		if (preg_match('/alert\s*\(/U', $ad_code))
26 13
		{
27
			return array(
28 3
				'severity'	=> 'warning',
29 3
				'message'	=> 'ALERT_USAGE',
30 3
			);
31
		}
32
33 10
		return false;
34
	}
35
}
36