services/_yf_autoloader.php

Summary

Maintainability
B
6 hrs
Test Coverage

Function _get_lib_path has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    function _get_lib_path($name, $params = []) {
        if (isset($this->php_libs[$name])) {
            return $this->php_libs[$name];
        }
        if (!isset($this->_paths_cache)) {
Severity: Minor
Found in services/_yf_autoloader.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 process_git has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function process_git() {
        $libs_root = $this->libs_root;
        $git_urls = $this->git_urls;
        foreach ((array)$git_urls as $git_url => $lib_dir) {
            $dir = $libs_root. $lib_dir;
Severity: Minor
Found in services/_yf_autoloader.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 process_yf_autoload has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process_yf_autoload() {
        $libs_root = $this->libs_root;
        $autoload_config = $this->autoload_config;
        if (!$autoload_config) {
            return false;
Severity: Minor
Found in services/_yf_autoloader.php - About 1 hr to fix

    Method _get_lib_path has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function _get_lib_path($name, $params = []) {
            if (isset($this->php_libs[$name])) {
                return $this->php_libs[$name];
            }
            if (!isset($this->_paths_cache)) {
    Severity: Minor
    Found in services/_yf_autoloader.php - About 1 hr to fix

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

          public function check_error($name, $dir, $check_file, $error_reason = 'git url or command is wrong') {
              $libs_root = $this->libs_root;
              $error_reasons = [];
              if (!file_exists($check_file)) {
                  if (!is_writable($dir)) {
      Severity: Minor
      Found in services/_yf_autoloader.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

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

          public function process_example() {
              $libs_root = $this->libs_root;
              $example = $this->example;
              if (!is_callable($example)) {
                  return false;
      Severity: Minor
      Found in services/_yf_autoloader.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

      There are no issues that match your filters.

      Category
      Status