fixate/pw-mvc-boilerplate

View on GitHub

Showing 25 of 27 total issues

Function clickToggler has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

export default function clickToggler(selector, opts = {}) {
  const elementPairs = [...document.querySelectorAll(selector)].map(elem => (
    {
      target: document.querySelector(elem.getAttribute('data-target')),
      trigger: elem,
Severity: Minor
Found in assets/js/lib/click-toggler.js - About 4 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 call has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  public function call()
  {
    $req = $this->request = f8\HttpRequest::instance();
    $this->response = new f8\HttpResponse();
    $method = strtolower($req->method());
Severity: Minor
Found in core/ApiController.php - About 3 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 clickToggler has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function clickToggler(selector, opts = {}) {
  const elementPairs = [...document.querySelectorAll(selector)].map(elem => (
    {
      target: document.querySelector(elem.getAttribute('data-target')),
      trigger: elem,
Severity: Major
Found in assets/js/lib/click-toggler.js - About 3 hrs to fix

    Function __call has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __call($method, $args)
        {
            if (property_exists(__CLASS__, $method) && is_callable($method)) {
                return call_user_func_array(array($this, $method), $args);
            } else {
    Severity: Minor
    Found in core/View.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 call has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public function call()
      {
        $req = $this->request = f8\HttpRequest::instance();
        $this->response = new f8\HttpResponse();
        $method = strtolower($req->method());
    Severity: Major
    Found in core/ApiController.php - About 2 hrs to fix

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

          public static function ls($path, $extension = null)
          {
              $result = array();
              if ($handle = opendir($path)) {
                  while (($file = readdir($handle)) !== false) {
      Severity: Minor
      Found in core/Utils.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 get_page_data has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        protected function get_page_data($page, array $fields = [])
        {
          $outputFormatting = $page->outputFormatting;
          $page->setOutputFormatting(false);
      
      
      Severity: Minor
      Found in core/ApiController.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 __construct has 12 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function __construct(&$config, &$fields, &$input, &$page, &$pages, &$permissions, &$roles, &$sanitizer, &$session, &$templates, &$user, &$users)
      Severity: Major
      Found in core/Controller.php - About 1 hr to fix

        Method __construct has 12 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          public function __construct(&$config, &$fields, &$input, &$page, &$pages, &$permissions, &$roles, &$sanitizer, &$session, &$templates, &$user, &$users)
        Severity: Major
        Found in core/ApiController.php - About 1 hr to fix

          Method init has 12 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static function init($config, $fields, $input, $page, $pages, $permissions, $roles, $sanitizer, $session, $templates, $user, $users)
          Severity: Major
          Found in core/Application.php - About 1 hr to fix

            Method get_page_data has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              protected function get_page_data($page, array $fields = [])
              {
                $outputFormatting = $page->outputFormatting;
                $page->setOutputFormatting(false);
            
            
            Severity: Minor
            Found in core/ApiController.php - About 1 hr to fix

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

                  protected function render_file($file, $_data = array(), $fallback = null)
                  {
                      if (!isset($this->data)) {
                          $this->data = array();
                      }
              Severity: Minor
              Found in core/View.php - About 1 hr to fix

                Method dynamic_load has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function dynamic_load($app)
                    {
                        $config = $app->config;
                        $fields = $app->fields;
                        $input = $app->input;
                Severity: Minor
                Found in core/Controller.php - About 1 hr to fix

                  Function __og_render_tags has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function __og_render_tags($tags)
                      {
                          $html = '';
                          foreach ($tags as $name => $value) {
                              if ($value !== null) {
                  Severity: Minor
                  Found in controllers/traits/open_graph.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 assets has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function assets($path, $use_min = true)
                      {
                          $is_production = Environment::is_production();
                          if ($is_production) {
                              // If use MD5# manifest in use get proper path
                  Severity: Minor
                  Found in core/View.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 get_contact_form has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    protected function get_contact_form()
                    {
                      $can_send = false;
                      $form_has_errors = false;
                      $input = $this->input;
                  Severity: Minor
                  Found in controllers/ContactController.php - About 1 hr to fix

                    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function __construct($statusCode, $message = null, \Exception $previous = null, array $headers = array(), $code = 0)
                    Severity: Minor
                    Found in core/Exceptions.php - About 35 mins to fix

                      Function __og_get_prop has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function __og_get_prop($prop, $field = null, $default = null)
                          {
                              $prop = $this->page->get($this->__og_opts["{$prop}_get"]);
                      
                              if ($prop && method_exists($this->page, $prop)) {
                      Severity: Minor
                      Found in controllers/traits/open_graph.php - About 35 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

                      Function render_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function render_file($file, $_data = array(), $fallback = null)
                          {
                              if (!isset($this->data)) {
                                  $this->data = array();
                              }
                      Severity: Minor
                      Found in core/View.php - About 35 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

                      Function starts_with has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function starts_with($haystack, $needle)
                          {
                              if (is_array($needle)) {
                                  foreach ($needle as $i) {
                                      if (strpos($haystack, $i) === 0) {
                      Severity: Minor
                      Found in core/Utils.php - About 25 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

                      Severity
                      Category
                      Status
                      Source
                      Language