Kylob/Bootstrap

View on GitHub

Showing 31 of 35 total issues

File Common.php has 667 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace BootPress\Bootstrap;

use BootPress\Page\Component as Page;
Severity: Major
Found in src/Common.php - About 1 day to fix

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

        public function links($tag, array $links, array $options = array())
        {
            $html = '';
            $class = null;
            if ($space = strpos($tag, ' ')) {
    Severity: Minor
    Found in src/Common.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

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

        public function toggle($type, array $links, array $options = array())
        {
            $count = 1;
            $toggle = array();
            $content = '';
    Severity: Minor
    Found in src/Common.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

    Function addClass has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function addClass($html, array $tags)
        {
            $rnr = array();
            foreach ($tags as $tag => $class) {
                $prefix = (is_array($class) && isset($class[2]) && is_array($class[1])) ? $class : false;
    Severity: Minor
    Found in src/Base.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 media has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        public function media(array $list, $parent = 0)
        {
            if (is_numeric($parent) && isset($list[0]) && is_array($list[0])) {
                $media = array();
                foreach ($list[$parent] as $child => $display) {
    Severity: Minor
    Found in src/Common.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

    Common has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Common
    {
        use Base;
    
        /** @var object A BootPress\Page\Component instance. */
    Severity: Minor
    Found in src/Common.php - About 3 hrs to fix

      Method links has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function links($tag, array $links, array $options = array())
          {
              $html = '';
              $class = null;
              if ($space = strpos($tag, ' ')) {
      Severity: Major
      Found in src/Common.php - About 2 hrs to fix

        Method toggle has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function toggle($type, array $links, array $options = array())
            {
                $count = 1;
                $toggle = array();
                $content = '';
        Severity: Major
        Found in src/Common.php - About 2 hrs to fix

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

              public function carousel(array $images, array $options = array())
              {
                  $html = '';
                  $id = $this->page->id('carousel');
                  $options = array_merge(array(
          Severity: Major
          Found in src/Common.php - About 2 hrs to fix

            Function field has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                public function field($prompt, $input, $error = null)
                {
                    foreach (array('input', 'select', 'textarea', 'button', 'p') as $tag) {
                        if ($this->firstTagAttributes($input, $matches, '<'.$tag)) {
                            break;
            Severity: Minor
            Found in src/Form.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 label has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function label($prompt, $name, $id)
                {
                    if (empty($prompt)) {
                        return '';
                    }
            Severity: Minor
            Found in src/Form.php - About 1 hr to fix

              Method media has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function media(array $list, $parent = 0)
                  {
                      if (is_numeric($parent) && isset($list[0]) && is_array($list[0])) {
                          $media = array();
                          foreach ($list[$parent] as $child => $display) {
              Severity: Minor
              Found in src/Common.php - About 1 hr to fix

                Method field has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function field($prompt, $input, $error = null)
                    {
                        foreach (array('input', 'select', 'textarea', 'button', 'p') as $tag) {
                            if ($this->firstTagAttributes($input, $matches, '<'.$tag)) {
                                break;
                Severity: Minor
                Found in src/Form.php - About 1 hr to fix

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

                      public function carousel(array $images, array $options = array())
                      {
                          $html = '';
                          $id = $this->page->id('carousel');
                          $options = array_merge(array(
                  Severity: Minor
                  Found in src/Common.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 label has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function label($prompt, $name, $id)
                      {
                          if (empty($prompt)) {
                              return '';
                          }
                  Severity: Minor
                  Found in src/Form.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 button has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function button($class, $name, array $options = array())
                      {
                          $attributes = array('type' => 'button');
                          foreach ($options as $key => $value) {
                              if (!in_array($key, array('dropdown', 'dropup', 'active', 'disabled', 'pull'))) {
                  Severity: Minor
                  Found in src/Common.php - About 1 hr to fix

                    Method accordion has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function accordion($class, array $sections, $open = 1)
                        {
                            $html = '';
                            $count = 0;
                            $id = $this->page->id('accordion');
                    Severity: Minor
                    Found in src/Common.php - About 1 hr to fix

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

                          public function open($brand, $align = '', $inverse = false)
                          {
                              if (is_array($brand)) {
                                  list($brand, $link) = (count($brand) > 1) ? $brand : each($brand);
                              } else {
                      Severity: Minor
                      Found in src/Navbar.php - About 1 hr to fix

                        Method search has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function search($url, array $form = array())
                            {
                                $html = '';
                                $form = array_merge(array(
                                    'name' => 'search',
                        Severity: Minor
                        Found in src/Common.php - About 1 hr to fix

                          Method addClass has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function addClass($html, array $tags)
                              {
                                  $rnr = array();
                                  foreach ($tags as $tag => $class) {
                                      $prefix = (is_array($class) && isset($class[2]) && is_array($class[1])) ? $class : false;
                          Severity: Minor
                          Found in src/Base.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language