felixarntz/wp-site-identity

View on GitHub
src/admin-pages/class-wp-site-identity-standard-admin-page-registry.php

Summary

Maintainability
A
1 hr
Test Coverage

Function get_url_to_admin_page has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_url_to_admin_page( WP_Site_Identity_Admin_Page $admin_page ) {
        $slug = $admin_page->get_slug();

        $query_args = array();

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Missing class import via use statement (line '87', column '14').
Open

            throw new WP_Site_Identity_Admin_Page_Not_Found_Exception( sprintf( __( 'The admin page with the slug %s could not be found.', 'wp-site-identity' ), $slug ) );

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '60', column '24').
Open

        $this->factory = new WP_Site_Identity_Admin_Page_Factory( $this );

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Avoid excessively long class names like WP_Site_Identity_Standard_Admin_Page_Registry. Keep class name length under 40.
Open

class WP_Site_Identity_Standard_Admin_Page_Registry implements WP_Site_Identity_Admin_Page_Registry {

    /**
     * Prefix to use for all admin page slugs within WordPress.
     *

LongClassName

Since: 2.9

Detects when classes or interfaces are declared with excessively long names.

Example

class ATooLongClassNameThatHintsAtADesignProblem {

}

interface ATooLongInterfaceNameThatHintsAtADesignProblem {

}

Source https://phpmd.org/rules/naming.html#longclassname

There are no issues that match your filters.

Category
Status