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\admanagement\acp;
* Advertisement management ACP module.
class main_module
{
public $page_title;
public $tpl_name;
public $u_action;
public function main($id, $mode)
$id
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$mode
global $phpbb_container;
global
Instead of relying on global state, we recommend one of these alternatives:
function myFunction($a, $b) { // Do something }
class MyClass { private $a; private $b; public function __construct($a, $b) { $this->a = $a; $this->b = $b; } public function myFunction() { // Do something } }
/** @var \phpbb\admanagement\controller\admin_controller $admin_controller */
$admin_controller = $phpbb_container->get('phpbb.admanagement.admin.controller');
// Make the $u_action url available in the admin controller
$admin_controller->set_page_url($this->u_action);
// Load a template from adm/style for our ACP page
$this->tpl_name = 'manage_ads';
// Set the page title for our ACP page
$this->page_title = $admin_controller->get_page_title();
switch ($admin_controller->get_action())
switch
This check looks for switch statements that have no cases or where all cases have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.
Consider removing the switch.
}
$admin_controller->list_ads();
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.