The method editpage has a boolean flag argument $clone, which is a certain sign of a Single Responsibility Principle violation. Open
function editpage($page_id = 0, $clone = FALSE) {
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method editpage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$pageObj->setVar('page_type', 'C');
$sform = $pageObj->getForm (_AM_SYSTEM_PAGES_CREATE, 'addpage');
$sform->assign ($icmsAdminTpl);
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Variable $icmsModule
is undeclared Open
if (!is_object(icms::$user) || !is_object($icmsModule) || !icms::$user->isAdmin($icmsModule->getVar("mid"))) {
- Exclude checks
Call to method __construct
from undeclared class \icms_ipf_view_Column
Open
$objectTable->addColumn(new icms_ipf_view_Column('page_moduleid', 'center', FALSE, 'getCustomPageModuleid'));
- Exclude checks
Call to method __construct
from undeclared class \icms_ipf_Controller
Open
$controller = new icms_ipf_Controller ($icms_page_handler);
- Exclude checks
Call to method __construct
from undeclared class \icms_ipf_view_Table
Open
$objectTable = new icms_ipf_view_Table($icms_page_handler);
- Exclude checks
Saw an @param annotation for post_id,
but it was not found in the param list of function editpage(int|mixed $page_id = 0, mixed $clone = null);
Open
* @param int $post_id Postid to be edited
- Exclude checks
Call to method __construct
from undeclared class \icms_ipf_view_Column
Open
$objectTable->addColumn(new icms_ipf_view_Column('page_status', 'center', FALSE, 'getCustomPageStatus'));
- Exclude checks
Call to method __construct
from undeclared class \icms_ipf_view_Column
Open
$objectTable->addColumn(new icms_ipf_view_Column('page_title', _GLOBAL_LEFT, FALSE, 'getAdminViewItemLink'));
- Exclude checks
Call to method __construct
from undeclared class \icms_ipf_view_Column
Open
$objectTable->addColumn(new icms_ipf_view_Column('page_url'));
- Exclude checks
Call to method addIntroButton
from undeclared class \icms_ipf_view_Table
Open
$objectTable->addIntroButton('addpost', 'admin.php?fct=pages&op=mod', _AM_SYSTEM_PAGES_CREATE);
- Exclude checks
Call to method fetch
from undeclared class \icms_ipf_view_Table
Open
$icmsAdminTpl->assign('icms_page_table', $objectTable->fetch());
- Exclude checks
Variable $icmsAdminTpl
is undeclared Open
$icmsAdminTpl->display('db:system_adm_pagemanager_index.html');
- Exclude checks
Call to method addColumn
from undeclared class \icms_ipf_view_Table
Open
$objectTable->addColumn(new icms_ipf_view_Column('page_url'));
- Exclude checks
Call to method addCustomAction
from undeclared class \icms_ipf_view_Table
Open
$objectTable->addCustomAction('getViewItemLink');
- Exclude checks
Reference to static property user
from undeclared class \icms
Open
if (!is_object(icms::$user) || !is_object($icmsModule) || !icms::$user->isAdmin($icmsModule->getVar("mid"))) {
- Exclude checks
Call to method addQuickSearch
from undeclared class \icms_ipf_view_Table
Open
$objectTable->addQuickSearch(array ('page_title', 'page_url'));
- Exclude checks
Variable $icmsAdminTpl
is undeclared Open
$icmsAdminTpl->assign('icms_page_table', $objectTable->fetch());
- Exclude checks
Variable $icmsAdminTpl
is undeclared Open
$icmsAdminTpl->assign('icms_page_title', _AM_SYSTEM_PAGES_TITLE);
- Exclude checks
Call to method addColumn
from undeclared class \icms_ipf_view_Table
Open
$objectTable->addColumn(new icms_ipf_view_Column('page_status', 'center', FALSE, 'getCustomPageStatus'));
- Exclude checks
Call to method addColumn
from undeclared class \icms_ipf_view_Table
Open
$objectTable->addColumn(new icms_ipf_view_Column('page_moduleid', 'center', FALSE, 'getCustomPageModuleid'));
- Exclude checks
Call to method __construct
from undeclared class \icms_ipf_Controller
Open
$controller = new icms_ipf_Controller($icms_page_handler);
- Exclude checks
Call to method storeFromDefaultForm
from undeclared class \icms_ipf_Controller
Open
$controller->storeFromDefaultForm(_AM_SYSTEM_PAGES_CREATED, _AM_SYSTEM_PAGES_MODIFIED);
- Exclude checks
Call to method handleObjectDeletion
from undeclared class \icms_ipf_Controller
Open
$controller->handleObjectDeletion();
- Exclude checks
Call to method addColumn
from undeclared class \icms_ipf_view_Table
Open
$objectTable->addColumn(new icms_ipf_view_Column('page_title', _GLOBAL_LEFT, FALSE, 'getAdminViewItemLink'));
- Exclude checks
Call to method addFilter
from undeclared class \icms_ipf_view_Table
Open
$objectTable->addFilter('page_moduleid', 'getModulesArray');
- Exclude checks
The parameter $page_id is not named in camelCase. Open
function editpage($page_id = 0, $clone = FALSE) {
global $icms_page_handler, $icmsAdminTpl;
$pageObj = $icms_page_handler->get($page_id);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
TRUE, FALSE and NULL must be lowercase; expected "true" but found "TRUE" Open
if (in_array($clean_op, $valid_op, TRUE)) {
- Exclude checks
There must be no space before the colon in a CASE statement Open
case "mod" :
- Exclude checks
There must be no space before the colon in a CASE statement Open
case "changedField" :
- Exclude checks
There must be no space before the colon in a CASE statement Open
case "clone" :
- Exclude checks
There must be no space before the colon in a CASE statement Open
case "del" :
- Exclude checks
There must be no space before the colon in a DEFAULT statement Open
default :
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE" Open
function editpage($page_id = 0, $clone = FALSE) {
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "true" but found "TRUE" Open
editpage($clean_page_id, TRUE);
- Exclude checks
There must be no space before the colon in a CASE statement Open
case "addpage" :
- Exclude checks
Blank line found at end of control structure Open
- Exclude checks
There must be no space before the colon in a CASE statement Open
case 'status' :
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE" Open
$objectTable->addColumn(new icms_ipf_view_Column('page_moduleid', 'center', FALSE, 'getCustomPageModuleid'));
- Exclude checks
Blank line found at end of control structure Open
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE" Open
$objectTable->addColumn(new icms_ipf_view_Column('page_title', _GLOBAL_LEFT, FALSE, 'getAdminViewItemLink'));
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE" Open
$objectTable->addColumn(new icms_ipf_view_Column('page_status', 'center', FALSE, 'getCustomPageStatus'));
- Exclude checks
Inline control structures are not allowed Open
if (isset($_POST ['op']))
- Exclude checks
Inline control structures are not allowed Open
if (isset($_GET['op']))
- Exclude checks
Space before opening parenthesis of function call prohibited Open
$sform->assign ($icmsAdminTpl);
- Exclude checks
Space before opening parenthesis of function call prohibited Open
icms_cp_header ();
- Exclude checks
Space before opening parenthesis of function call prohibited Open
icms_cp_header ();
- Exclude checks
Space before opening parenthesis of function call prohibited Open
$controller = new icms_ipf_Controller ($icms_page_handler);
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$icms_page_handler->changeStatus( $clean_page_id );
- Exclude checks
Space before opening parenthesis of function call prohibited Open
$sform->assign ($icmsAdminTpl);
- Exclude checks
Space before opening parenthesis of function call prohibited Open
exit ("Access Denied");
- Exclude checks
Space before opening parenthesis of function call prohibited Open
$sform = $pageObj->getForm (_AM_SYSTEM_PAGES_CREATE, 'addpage');
- Exclude checks
Expected 1 newline at end of file; 0 found Open
}
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$icms_page_handler->changeStatus( $clean_page_id );
- Exclude checks
Space before opening parenthesis of function call prohibited Open
$sform = $pageObj->getForm (_AM_SYSTEM_PAGES_EDIT, 'addpage');
- Exclude checks
The variable $icms_page_handler is not named in camelCase. Open
function editpage($page_id = 0, $clone = FALSE) {
global $icms_page_handler, $icmsAdminTpl;
$pageObj = $icms_page_handler->get($page_id);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $page_id is not named in camelCase. Open
function editpage($page_id = 0, $clone = FALSE) {
global $icms_page_handler, $icmsAdminTpl;
$pageObj = $icms_page_handler->get($page_id);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $icms_page_handler is not named in camelCase. Open
function editpage($page_id = 0, $clone = FALSE) {
global $icms_page_handler, $icmsAdminTpl;
$pageObj = $icms_page_handler->get($page_id);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $page_id is not named in camelCase. Open
function editpage($page_id = 0, $clone = FALSE) {
global $icms_page_handler, $icmsAdminTpl;
$pageObj = $icms_page_handler->get($page_id);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}