awsmug/torro-forms

View on GitHub
src/assets.php

Summary

Maintainability
D
1 day
Test Coverage

Method register_assets has 211 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function register_assets() {
        $this->register_style(
            'frontend',
            'assets/dist/css/frontend.css',
            array(
Severity: Major
Found in src/assets.php - About 1 day to fix

    File assets.php has 317 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Assets manager class
     *
     * @package TorroForms
    Severity: Minor
    Found in src/assets.php - About 3 hrs to fix

      Method setup_hooks has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function setup_hooks() {
              $this->actions = array(
                  array(
                      'name'     => 'wp_enqueue_scripts',
                      'callback' => array( $this, 'register_assets' ),
      Severity: Minor
      Found in src/assets.php - About 1 hr to fix

        Function get_full_path has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function get_full_path( $src, $url = false ) {
                if ( preg_match( '/^(http|https):\/\//', $src ) || 0 === strpos( $src, '//' ) ) {
                    if ( $url ) {
                        return $src;
                    }
        Severity: Minor
        Found in src/assets.php - About 45 mins to fix

        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

        Avoid too many return statements within this method.
        Open

                return parent::get_full_path( $src, $url );
        Severity: Major
        Found in src/assets.php - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status