koselig/library

View on GitHub

Showing 59 of 59 total issues

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

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

              public static function multisite($id = null)
              {
                  if (is_array($id)) {
                      foreach ($id as $i) {
                          if (static::multisite($i)) {
          Severity: Minor
          Found in src/Support/Wordpress.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

          The method getACF() has an NPath complexity of 392. The configured NPath complexity threshold is 200.
          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 by phpmd

          NPathComplexity

          Since: 0.1

          The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

          Example

          class Foo {
              function bar() {
                  // lots of complicated code
              }
          }

          Source https://phpmd.org/rules/codesize.html#npathcomplexity

          The method acf() has an NPath complexity of 384. The configured NPath complexity threshold is 200.
          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 by phpmd

          NPathComplexity

          Since: 0.1

          The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

          Example

          class Foo {
              function bar() {
                  // lots of complicated code
              }
          }

          Source https://phpmd.org/rules/codesize.html#npathcomplexity

          register accesses the super-global variable $GLOBALS.
          Open

              public function register()
              {
                  $this->app->singleton('query', function () {
                      // main page query
                      return Query::instance($GLOBALS['wp_the_query']);

          Superglobals

          Since: 0.2

          Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

          Example

          class Foo {
              public function bar() {
                  $name = $_POST['foo'];
              }
          }

          Source

          register accesses the super-global variable $GLOBALS.
          Open

              public function register()
              {
                  $this->app->singleton('query', function () {
                      // main page query
                      return Query::instance($GLOBALS['wp_the_query']);

          Superglobals

          Since: 0.2

          Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

          Example

          class Foo {
              public function bar() {
                  $name = $_POST['foo'];
              }
          }

          Source

          version accesses the super-global variable $GLOBALS.
          Open

              public static function version()
              {
                  if (!isset($GLOBALS['wp_version'])) {
                      require_once ABSPATH . WPINC . '/version.php';
                  }
          Severity: Minor
          Found in src/Support/Wordpress.php by phpmd

          Superglobals

          Since: 0.2

          Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

          Example

          class Foo {
              public function bar() {
                  $name = $_POST['foo'];
              }
          }

          Source

          addSidebarSupport accesses the super-global variable $GLOBALS.
          Open

              public function addSidebarSupport()
              {
                  collect(config('sidebars'))->each(function ($value) {
                      register_sidebar(array_merge([
                          'name' => '',

          Superglobals

          Since: 0.2

          Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

          Example

          class Foo {
              public function bar() {
                  $name = $_POST['foo'];
              }
          }

          Source

          version accesses the super-global variable $GLOBALS.
          Open

              public static function version()
              {
                  if (!isset($GLOBALS['wp_version'])) {
                      require_once ABSPATH . WPINC . '/version.php';
                  }
          Severity: Minor
          Found in src/Support/Wordpress.php by phpmd

          Superglobals

          Since: 0.2

          Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

          Example

          class Foo {
              public function bar() {
                  $name = $_POST['foo'];
              }
          }

          Source

          Only one argument is allowed per line in a multi-line function call
          Open

                      Route::getPatterns(), $route->getAction()['where'] ?? []
          Severity: Minor
          Found in src/Routing/Routing.php by phpcodesniffer

          Opening parenthesis of a multi-line function call must be the last content on the line
          Open

                  View::addNamespace('theme',

          Multi-line function call not indented correctly; expected 8 spaces but found 27
          Open

                                     base_path() . '/resources/views/themes/' . wp_get_theme()->stylesheet);

          Multi-line function call not indented correctly; expected 8 spaces but found 16
          Open

                          true)['extra']['wordpress-install-dir'] . '/');

          Closing parenthesis of a multi-line function call must be on a line by itself
          Open

                          true)['extra']['wordpress-install-dir'] . '/');

          Closing parenthesis of a multi-line function call must be on a line by itself
          Open

                                     base_path() . '/resources/views/themes/' . wp_get_theme()->stylesheet);

          Opening parenthesis of a multi-line function call must be the last content on the line
          Open

                  define('WP_PATH', json_decode(file_get_contents($this->app->basePath() . DIRECTORY_SEPARATOR . 'composer.json'),
          Severity
          Category
          Status
          Source
          Language