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

alert::run()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 12
Ratio 100 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
dl 12
loc 12
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
crap 2
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