Kylob/BootPress

View on GitHub
src/Admin/Component.php

Summary

Maintainability
F
4 days
Test Coverage

Function display has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

    public static function display($content)
    {
        extract(self::params('auth', 'website', 'page', 'admin', 'plugin'));
        $page->meta('http-equiv="X-UA-Compatible" content="IE=edge"');
        $page->meta('content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"');
Severity: Minor
Found in src/Admin/Component.php - About 7 hrs 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

File Component.php has 432 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace BootPress\Admin;

use BootPress\Auth\Component as Auth;
Severity: Minor
Found in src/Admin/Component.php - About 6 hrs to fix

    Function setup has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function setup(Auth $auth, Blog $blog, array $map)
        {
            $html = '';
            if (!isset(static::$version['bootstrap'])) {
                return $html;
    Severity: Minor
    Found in src/Admin/Component.php - About 5 hrs 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

    Method display has 139 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function display($content)
        {
            extract(self::params('auth', 'website', 'page', 'admin', 'plugin'));
            $page->meta('http-equiv="X-UA-Compatible" content="IE=edge"');
            $page->meta('content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"');
    Severity: Major
    Found in src/Admin/Component.php - About 5 hrs to fix

      Method setup has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function setup(Auth $auth, Blog $blog, array $map)
          {
              $html = '';
              if (!isset(static::$version['bootstrap'])) {
                  return $html;
      Severity: Major
      Found in src/Admin/Component.php - About 3 hrs to fix

        Method wyciwyg has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function wyciwyg()
            {
                extract(self::params('bp', 'page', 'plugin'));
                $html = "\n\n".<<<EOT
        <div id="wyciwyg" style="display:none; width:100%; padding:0 10px;">
        Severity: Major
        Found in src/Admin/Component.php - About 2 hrs to fix

          Function sidebar has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function sidebar($links, $prepend = false)
              {
                  if (is_array($links)) {
                      $page = Page::html();
                      foreach ($links as $name => $path) {
          Severity: Minor
          Found in src/Admin/Component.php - About 2 hrs 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

          Function box has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function box($style, array $contents)
              {
                  $box = '';
                  $classes = 'box box-'.implode(' box-', explode(' ', $style)); // solid, default, primary, info, warning, success, danger
                  foreach ($contents as $section => $value) {
          Severity: Minor
          Found in src/Admin/Component.php - About 2 hrs 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

          Method box has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function box($style, array $contents)
              {
                  $box = '';
                  $classes = 'box box-'.implode(' box-', explode(' ', $style)); // solid, default, primary, info, warning, success, danger
                  foreach ($contents as $section => $value) {
          Severity: Minor
          Found in src/Admin/Component.php - About 1 hr to fix

            There are no issues that match your filters.

            Category
            Status