Showing 51 of 53 total issues

Function query has a Cognitive Complexity of 146 (exceeds 5 allowed). Consider refactoring.
Open

    public function query($type, $params = null)
    {
        $posts = array();
        if (is_array($type)) { // listings
            $vars = array();
Severity: Minor
Found in src/Blog.php - About 2 days 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 942 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace BootPress\Blog;

use BootPress\Page\Component as Page;
Severity: Major
Found in src/Blog.php - About 2 days to fix

    Method query has 371 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function query($type, $params = null)
        {
            $posts = array();
            if (is_array($type)) { // listings
                $vars = array();
    Severity: Major
    Found in src/Blog.php - About 1 day to fix

      Method getTwig has 239 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getTwig(array $options = array())
          {
              if (is_null($this->twig)) {
                  $page = Page::html();
                  foreach (array('content', 'plugins', 'themes') as $dir) {
      Severity: Major
      Found in src/Twig/Theme.php - About 1 day to fix

        File Theme.php has 509 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace BootPress\Blog\Twig;
        
        use BootPress\Page\Component as Page;
        Severity: Major
        Found in src/Twig/Theme.php - About 1 day to fix

          Function config has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

              public function config($key = null)
              {
                  $args = func_get_args(); // In PHP7, func_get_args() are changed by the time we use them, so we call it now
                  if (is_null($this->config)) {
                      $file = $this->folder.'config.yml';
          Severity: Minor
          Found in src/Blog.php - 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 getId has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getId($table, $value)
              {
                  if (is_null($this->ids)) {
                      $this->ids = array(
                          'updated' => array(
          Severity: Minor
          Found in src/Blog.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

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

              public function info($ids)
              {
                  $page = Page::html();
                  $single = (is_array($ids)) ? false : true;
                  if (empty($ids)) {
          Severity: Major
          Found in src/Blog.php - About 2 hrs to fix

            Function getFiles has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                private function getFiles($name, $default = null)
                {
                    $files = array();
                    if (!empty($name)) {
                        $page = Page::html();
            Severity: Minor
            Found in src/Twig/Theme.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 file has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                public function file($path)
                {
                    $blog = $this->db->row('SELECT id, path, updated, search, content FROM blog WHERE path = ?', $path, 'assoc');
                    if (!$current = $this->blogInfo($path)) { // delete
                        if ($blog) {
            Severity: Minor
            Found in src/Blog.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 info has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                public function info($ids)
                {
                    $page = Page::html();
                    $single = (is_array($ids)) ? false : true;
                    if (empty($ids)) {
            Severity: Minor
            Found in src/Blog.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 __construct has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function __construct($folder = 'blog')
                {
                    $page = Page::html();
            
                    // $this->folder
            Severity: Major
            Found in src/Blog.php - About 2 hrs to fix

              Method updateConfig has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function updateConfig()
                  {
                      if ($this->getId('updated', 'anything') === false) {
                          return;
                      }
              Severity: Major
              Found in src/Blog.php - About 2 hrs to fix

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

                    private function blogInfo($path)
                    {
                        $page = Page::html();
                        $dir = $this->folder.'content/';
                        if (preg_match('/[^'.$page->url['chars'].'\/]/', $path)) {
                Severity: Minor
                Found in src/Blog.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 getId has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function getId($table, $value)
                    {
                        if (is_null($this->ids)) {
                            $this->ids = array(
                                'updated' => array(
                Severity: Major
                Found in src/Blog.php - About 2 hrs to fix

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

                      public function file($path)
                      {
                          $blog = $this->db->row('SELECT id, path, updated, search, content FROM blog WHERE path = ?', $path, 'assoc');
                          if (!$current = $this->blogInfo($path)) { // delete
                              if ($blog) {
                  Severity: Major
                  Found in src/Blog.php - About 2 hrs to fix

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

                        private function updateDatabase()
                        {
                            set_time_limit(0);
                            $blog = $this->db->insert('blog', array('page', 'path', 'title', 'featured', 'published', 'updated', 'author_id', 'category_id', 'search', 'content'));
                            $tagged = $this->db->insert('tagged', array('blog_id', 'tag_id'));
                    Severity: Minor
                    Found in src/Blog.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 blogInfo has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function blogInfo($path)
                        {
                            $page = Page::html();
                            $dir = $this->folder.'content/';
                            if (preg_match('/[^'.$page->url['chars'].'\/]/', $path)) {
                    Severity: Major
                    Found in src/Blog.php - About 2 hrs to fix

                      Method renderTwig has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function renderTwig($file, array $vars = array())
                          {
                              $page = Page::html();
                              if (is_array($file)) {
                                  $vars = (isset($file['vars']) && is_array($file['vars'])) ? $file['vars'] : array();
                      Severity: Major
                      Found in src/Twig/Theme.php - About 2 hrs to fix

                        Method config has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function config($key = null)
                            {
                                $args = func_get_args(); // In PHP7, func_get_args() are changed by the time we use them, so we call it now
                                if (is_null($this->config)) {
                                    $file = $this->folder.'config.yml';
                        Severity: Minor
                        Found in src/Blog.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language