samsonos/php_core

View on GitHub

Showing 51 of 51 total issues

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

    public static function set(array $available_locales)
    {
        // Переберем локализации
        foreach ($available_locales as $locale) {
            $_locale = strtolower($locale);
Severity: Minor
Found in src/SamsonLocale.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 sizeof($var);
Severity: Major
Found in src/View.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return (!isset($value) && isset($var{0})) ||
                    (isset($value) && $var === strval($value));
    Severity: Major
    Found in src/View.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return false;
      Severity: Major
      Found in src/View.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

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

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

              protected function viewContext($view_path)
              {
                  // Pointer to NEW view data context
                  $new = &$this->view_data[$view_path];
          
          
          Severity: Minor
          Found in src/Module.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

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

              public function __set($value, $field = null)
              {
                  if (is_object($field) || is_array($field)) {
                      $tempValue = $field;
                      $field = $value;
          Severity: Minor
          Found in src/Module.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

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

              public function view($viewPath)
              {
                  if (is_a($viewPath, ViewInterface::class)) {
                      $this->view_path = $viewPath;
                      return $this;
          Severity: Minor
          Found in src/ExternalModule.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

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

              public function createMetadata($class, $name, $path, $scope = 'module') : ClassMetadata
              {
                  $metadata = new ClassMetadata();
                  $class = ltrim($class, '\\');
                  $name = strtolower(ltrim($name, '\\'));
          Severity: Minor
          Found in src/loader/ContainerManager.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

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

          function isval($name, $value = null, $success = null, $failure = null, $inverse = false)
          {
              // Pointer to current module
              $m = m();
          
          
          Severity: Minor
          Found in src/View.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

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

              public static function clear($path, $type = NULL, $ignoreFolders = array())
              {
                  // Если передан путь к папке то удалим все файлы в ней
                  if (is_dir($path)) {
                      $files = array();
          Severity: Minor
          Found in src/File.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

          Severity
          Category
          Status
          Source
          Language