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; |
12
|
|
|
|
13
|
|
|
class manager |
14
|
|
|
{ |
15
|
|
|
/** @var array Ad code analysis tests */ |
16
|
|
|
protected $tests; |
17
|
|
|
|
18
|
|
|
/** @var \phpbb\template\template */ |
|
|
|
|
19
|
|
|
protected $template; |
20
|
|
|
|
21
|
|
|
/** @var \phpbb\language\language */ |
|
|
|
|
22
|
|
|
protected $lang; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Construct an ad code analysis manager object |
26
|
|
|
* |
27
|
|
|
* @param array $tests Ad code analysis tests passed via the service container |
28
|
|
|
* @param \phpbb\template\template $template Template object |
29
|
|
|
* @param \phpbb\language\language $lang Language object |
30
|
|
|
*/ |
31
|
|
|
public function __construct($tests, \phpbb\template\template $template, \phpbb\language\language $lang) |
32
|
|
|
{ |
33
|
|
|
$this->tests = $tests; |
34
|
|
|
$this->template = $template; |
35
|
13 |
|
$this->lang = $lang; |
36
|
|
|
} |
37
|
13 |
|
|
38
|
13 |
|
/** |
39
|
13 |
|
* Test the ad code for potential problems. |
40
|
13 |
|
* |
41
|
13 |
|
* @param string $ad_code Advertisement code |
42
|
|
|
*/ |
43
|
|
|
public function run($ad_code) |
44
|
|
|
{ |
45
|
|
|
$results = array(); |
46
|
|
|
foreach ($this->tests as $test) |
47
|
|
|
{ |
48
|
13 |
|
$result = $test->run($ad_code); |
49
|
|
|
if ($result !== false) |
50
|
13 |
|
{ |
51
|
13 |
|
$results[] = $result; |
52
|
|
|
} |
53
|
13 |
|
} |
54
|
13 |
|
|
55
|
13 |
|
$this->assign_template_vars($results); |
56
|
10 |
|
} |
57
|
10 |
|
|
58
|
13 |
|
/** |
59
|
|
|
* Assign analyser results to template variables. |
60
|
13 |
|
* |
61
|
13 |
|
* @param array $results Analyser results |
62
|
|
|
*/ |
63
|
|
|
protected function assign_template_vars($results) |
64
|
|
|
{ |
65
|
|
|
foreach ($results as $result) |
66
|
|
|
{ |
67
|
|
|
$this->template->assign_block_vars('analyser_results_' . $result['severity'], array( |
68
|
13 |
|
'MESSAGE' => $this->lang->lang($result['message']), |
69
|
|
|
)); |
70
|
13 |
|
} |
71
|
|
|
|
72
|
10 |
|
$this->template->assign_var('CODE_ANALYSED', true); |
73
|
10 |
|
} |
74
|
|
|
} |
75
|
|
|
|
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