Completed
Pull Request — master (#43)
by Jakub
29:32 queued 27:43
created

front_controller::increment_clicks()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
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\controller;
12
13
/**
14
* Front controller
15
*/
16
class front_controller
17
{
18
	/** @var \phpbb\ads\ad\manager */
19
	protected $manager;
20
21
	/** @var \phpbb\controller\helper */
22
	protected $helper;
23
24
	/**
25
	* Constructor
26
	*
27
	* @param \phpbb\ads\ad\manager		$manager	Advertisement manager object
28
	* @param \phpbb\controller\helper	$helper		Controller helper object
29
	*/
30
	public function __construct(\phpbb\ads\ad\manager $manager, \phpbb\controller\helper $helper)
31
	{
32
		$this->manager = $manager;
33
		$this->helper = $helper;
34
	}
35
36
	/**
37
	* Increment clicks for an ad
38
	*
39
	* @param int	$ad_id	Advertisement ID
40
	* @return void
41
	*/
42
	public function increment_clicks($ad_id)
43
	{
44
		$this->manager->increment_ad_clicks($ad_id);
0 ignored issues
show
Documentation introduced by
$ad_id is of type integer, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
45
46
		return $this->helper->message('');
47
	}
48
}
49