koselig/library

View on GitHub

Showing 21 of 59 total issues

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

    public function getACF($key = null, $format = true)
    {
        if (!function_exists('acf_format_value')) {
            throw new UnsatisfiedDependencyException('Advanced Custom Fields must be installed to use field');
        }
Severity: Minor
Found in src/Models/Post.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

Post has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class Post extends Model
{
    use Rememberable;

    public $timestamps = false;
Severity: Minor
Found in src/Models/Post.php - About 2 hrs to fix

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

        public function query($query)
        {
            if (!$this->ready) {
                $this->check_current_query = true;
    
    
    Severity: Minor
    Found in src/Proxy/WordpressDatabase.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 query has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function query($query)
        {
            if (!$this->ready) {
                $this->check_current_query = true;
    
    
    Severity: Minor
    Found in src/Proxy/WordpressDatabase.php - About 1 hr to fix

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

          public function getACF($key = null, $format = true)
          {
              if (!function_exists('acf_format_value')) {
                  throw new UnsatisfiedDependencyException('Advanced Custom Fields must be installed to use field');
              }
      Severity: Minor
      Found in src/Models/Post.php - About 1 hr to fix

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

            function __($key, $replace = [], $locale = null)
            {
                if (is_array($replace)) {
                    try {
                        return app('translator')->getFromJson($key, $replace, $locale);
        Severity: Minor
        Found in src/helpers.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 acf has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function acf($page = null, $name = null, $format = true)
            {
                if (!function_exists('acf_format_value')) {
                    throw new UnsatisfiedDependencyException('Advanced Custom Fields must be installed to use field');
                }
        Severity: Minor
        Found in src/Models/Meta.php - About 1 hr to fix

          Function acf has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function acf($page = null, $name = null, $format = true)
              {
                  if (!function_exists('acf_format_value')) {
                      throw new UnsatisfiedDependencyException('Advanced Custom Fields must be installed to use field');
                  }
          Severity: Minor
          Found in src/Models/Meta.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 __call has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __call($name, $arguments)
              {
                  $name = Str::snake($name);
                  $name = str_replace('has', 'have', $name);
          
          
          Severity: Minor
          Found in src/Proxy/Query.php - About 55 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

          Method addPage has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static function addPage($pageTitle, $menuTitle, $capability, $slug, $action, $iconUrl = '', $position = null)
          Severity: Major
          Found in src/Admin/Page.php - About 50 mins to fix

            Function _do_query has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                private function _do_query($query)
                {
                    if (defined('SAVEQUERIES') && SAVEQUERIES) {
                        $this->timer_start();
                    }
            Severity: Minor
            Found in src/Proxy/WordpressDatabase.php - About 45 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

            Method addSubpage has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public static function addSubpage($parent, $pageTitle, $menuTitle, $capabilities, $slug, $action)
            Severity: Minor
            Found in src/Admin/Page.php - About 45 mins to fix

              Function get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function get($page = null, $name = null)
                  {
                      if (is_object($page) && (is_subclass_of($page, Post::class) || $page instanceof Post)) {
                          $page = $page->ID;
                      }
              Severity: Minor
              Found in src/Models/Meta.php - About 45 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

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

                  function wp_mail($to, $subject, $message, $headers = '', $attachments = [])
              Severity: Minor
              Found in src/Mail/Mailer.php - About 35 mins to fix

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

                    function wp_mail($to, $subject, $message, $headers = '', $attachments = [])
                    {
                        list($to, $subject, $headers, $attachments) = array_values(
                            Action::filter('wp_mail', [$to, $subject, $message, $headers, $attachments])
                        );
                Severity: Minor
                Found in src/Mail/Mailer.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 add has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function add($key, $value, $group = 'default', $expiration = 0)
                    {
                        if (wp_suspend_cache_addition()) {
                            return false;
                        }
                Severity: Minor
                Found in src/Proxy/WordpressCache.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

                Avoid too many return statements within this method.
                Open

                        return static::getCache($group)->add($this->buildKey($group, $key), $value, $expiration / 60);
                Severity: Major
                Found in src/Proxy/WordpressCache.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return true;
                  Severity: Major
                  Found in src/Proxy/WordpressCache.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return true;
                    Severity: Major
                    Found in src/Proxy/WordpressCache.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return "<?php gravity_form({$expression}); ?>";
                      Severity: Major
                      Found in src/Providers/WordpressTemplatingServiceProvider.php - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language