for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
*
* Advertisement management. An extension for the phpBB Forum Software package.
* @copyright (c) 2017 phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*/
namespace phpbb\ads\analyser;
class manager
{
/** @var array Ad code analysis tests */
protected $tests;
/** @var \phpbb\request\request */
protected $request;
/** @var \phpbb\template\template */
protected $template;
/** @var \phpbb\language\language */
protected $lang;
* Construct an ad code analysis manager object
* @param array $tests Ad code analysis tests passed via the service container
* @param \phpbb\request\request $request Request object
* @param \phpbb\template\template $template Template object
* @param \phpbb\language\language $lang Language object
public function __construct($tests, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\language\language $lang)
$this->tests = $tests;
$this->request = $request;
$this->template = $template;
$this->lang = $lang;
}
public function test($ad_code)
$result = array(
'notice' => array(),
'warning' => array(),
);
foreach ($this->tests as $test)
$result = array_merge_recursive($result, $test->test($ad_code));
foreach ($result as $severity => $messages)
foreach ($messages as $lang_key)
$this->template->assign_block_vars('analyser_results_' . $severity, array(
'MESSAGE' => $this->lang->lang($lang_key),
));