Kylob/BootPress

View on GitHub
src/Admin/Pages/Blog.php

Summary

Maintainability
F
5 days
Test Coverage

Function form has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
Open

    private static function form()
    {
        extract(Admin::params(array('bp', 'blog', 'page', 'plugin', 'website')));
        $html = '';
        $media = '';
Severity: Minor
Found in src/Admin/Pages/Blog.php - About 1 day 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 Blog.php has 522 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace BootPress\Admin\Pages;

use BootPress\Admin\Files;
Severity: Major
Found in src/Admin/Pages/Blog.php - About 1 day to fix

    Method form has 192 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private static function form()
        {
            extract(Admin::params(array('bp', 'blog', 'page', 'plugin', 'website')));
            $html = '';
            $media = '';
    Severity: Major
    Found in src/Admin/Pages/Blog.php - About 7 hrs to fix

      Method page has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function page()
          {
              extract(Admin::params('bp', 'blog', 'auth', 'page', 'admin', 'path', 'method'));
              if ($method) {
                  switch ($method) {
      Severity: Major
      Found in src/Admin/Pages/Blog.php - About 2 hrs to fix

        Method restore has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static function restore()
            {
                extract(Admin::params('bp', 'page', 'blog', 'website'));
                $page->title = 'Restore Blog at '.$website;
                $html = '';
        Severity: Minor
        Found in src/Admin/Pages/Blog.php - About 1 hr to fix

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

              private static function restore()
              {
                  extract(Admin::params('bp', 'page', 'blog', 'website'));
                  $page->title = 'Restore Blog at '.$website;
                  $html = '';
          Severity: Minor
          Found in src/Admin/Pages/Blog.php - About 1 hr 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 setup has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function setup($auth, $path)
              {
                  if (!$auth->isAdmin(2)) {
                      return false;
                  }
          Severity: Minor
          Found in src/Admin/Pages/Blog.php - About 1 hr 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 setup has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function setup($auth, $path)
              {
                  if (!$auth->isAdmin(2)) {
                      return false;
                  }
          Severity: Minor
          Found in src/Admin/Pages/Blog.php - About 1 hr to fix

            Method ids has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static function ids(array $ids, array $snippets = array())
                {
                    $html = '';
                    extract(Admin::params(array('bp', 'blog', 'page')));
                    foreach ($blog->info($ids) as $id => $row) {
            Severity: Minor
            Found in src/Admin/Pages/Blog.php - About 1 hr to fix

              Function page has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function page()
                  {
                      extract(Admin::params('bp', 'blog', 'auth', 'page', 'admin', 'path', 'method'));
                      if ($method) {
                          switch ($method) {
              Severity: Minor
              Found in src/Admin/Pages/Blog.php - About 1 hr 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 ids has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static function ids(array $ids, array $snippets = array())
                  {
                      $html = '';
                      extract(Admin::params(array('bp', 'blog', 'page')));
                      foreach ($blog->info($ids) as $id => $row) {
              Severity: Minor
              Found in src/Admin/Pages/Blog.php - About 1 hr 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

              There must be one blank line after the last USE statement; 0 found;
              Open

              use ZipStream; // maennchen/zipstream-php
              Severity: Minor
              Found in src/Admin/Pages/Blog.php by phpcodesniffer

              Blank line found at start of control structure
              Open

                      } else {
              Severity: Minor
              Found in src/Admin/Pages/Blog.php by phpcodesniffer

              Blank line found at start of control structure
              Open

                      if ($edit) {
              Severity: Minor
              Found in src/Admin/Pages/Blog.php by phpcodesniffer

              There are no issues that match your filters.

              Category
              Status