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 | * Increment controller |
||
15 | */ |
||
16 | class increment_controller |
||
17 | { |
||
18 | /** @var \phpbb\ads\ad\manager */ |
||
19 | protected $manager; |
||
20 | |||
21 | /** @var \phpbb\request\request */ |
||
0 ignored issues
–
show
|
|||
22 | protected $request; |
||
23 | |||
24 | /** |
||
25 | * Constructor |
||
26 | * |
||
27 | * @param \phpbb\ads\ad\manager $manager Advertisement manager object |
||
28 | * @param \phpbb\request\request $request Request object |
||
29 | */ |
||
30 | 7 | public function __construct(\phpbb\ads\ad\manager $manager, \phpbb\request\request $request) |
|
31 | { |
||
32 | 7 | $this->manager = $manager; |
|
33 | 7 | $this->request = $request; |
|
34 | 7 | } |
|
35 | |||
36 | /** |
||
37 | * Handle request. |
||
38 | * |
||
39 | * @param mixed $data Ad ID or ad IDs |
||
40 | * @param string $mode clicks or views |
||
41 | * @return \Symfony\Component\HttpFoundation\JsonResponse A Symfony JsonResponse object |
||
42 | * @throws \phpbb\exception\http_exception |
||
43 | */ |
||
44 | 7 | public function handle($data, $mode) |
|
45 | { |
||
46 | 7 | if (!empty($data) && $this->request->is_ajax()) |
|
47 | 7 | { |
|
48 | 3 | $this->{$mode}($data); |
|
49 | |||
50 | 3 | return new \Symfony\Component\HttpFoundation\JsonResponse(); |
|
0 ignored issues
–
show
The type
Symfony\Component\HttpFoundation\JsonResponse was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
51 | } |
||
52 | |||
53 | 4 | throw new \phpbb\exception\http_exception(403, 'NOT_AUTHORISED'); |
|
0 ignored issues
–
show
The type
phpbb\exception\http_exception was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
54 | } |
||
55 | |||
56 | /** |
||
57 | * Increment clicks for an ad. |
||
58 | * |
||
59 | * @param int $ad_id Advertisement ID |
||
60 | */ |
||
61 | 1 | protected function clicks($ad_id) |
|
62 | { |
||
63 | 1 | $this->manager->increment_ad_clicks($ad_id); |
|
64 | 1 | } |
|
65 | |||
66 | /** |
||
67 | * Increment views for ads. |
||
68 | * |
||
69 | * @param string $ad_ids Advertisement IDs |
||
70 | */ |
||
71 | 2 | protected function views($ad_ids) |
|
72 | { |
||
73 | 2 | $this->manager->increment_ads_views(explode('-', $ad_ids)); |
|
74 | 2 | } |
|
75 | } |
||
76 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths