samsonos/php_core

View on GitHub

Showing 51 of 51 total issues

Function replaceInterfaceDependencies has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

    public function replaceInterfaceDependencies(array $metadataCollection) {

        $list = [];
        $listPath = [];
        /** @var ClassMetadata $classMetadata */
Severity: Minor
Found in src/loader/ContainerManager.php - About 1 day 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 dir has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

    public static function dir($path, $type = null, $modifier = '', & $result = array(), $max_level = NULL, $level = 0, $restrict = array('.git', '.svn', '.hg', '.settings'))
    {
        // Если установлено ограничение на глубину - выйдем
        if (isset($max_level) && $level > $max_level) return $result;

Severity: Minor
Found in src/File.php - About 6 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 handler has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    public function handler($errno, $error_msg, $errfile = NULL, $errline = NULL, $errcontext = NULL, $backtrace = NULL)
    {
        // Если вывод ошибок включен
        if (!self::$OUTPUT) return NULL;

Severity: Minor
Found in src/deprecated/Error.php - About 5 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 init has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function init()
    {
        $containerPath = __DIR__ . '/../../../../../www/cache';
        $containerName = 'ContainerCore';
        $containerNamespace = 'samsonphp\core\loader';
Severity: Minor
Found in src/loader/CoreLoader.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

Method handler has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handler($errno, $error_msg, $errfile = NULL, $errline = NULL, $errcontext = NULL, $backtrace = NULL)
    {
        // Если вывод ошибок включен
        if (!self::$OUTPUT) return NULL;

Severity: Major
Found in src/deprecated/Error.php - About 3 hrs to fix

    File Utils2.php has 307 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Get difference time entities between two dates
     *
    Severity: Minor
    Found in src/Utils2.php - About 3 hrs to fix

      Method init has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function init()
          {
              $containerPath = __DIR__ . '/../../../../../www/cache';
              $containerName = 'ContainerCore';
              $containerNamespace = 'samsonphp\core\loader';
      Severity: Major
      Found in src/loader/CoreLoader.php - About 3 hrs to fix

        Module has 25 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Module implements \ArrayAccess, iModule
        {
            /** Static module instances collection */
            public static $instances = array();
        
        
        Severity: Minor
        Found in src/Module.php - About 2 hrs to fix

          Function oldModule has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              protected static function oldModule($className, $nameSpace, & $file = null)
              {
                  //elapsed('++ Autoloading '.$value.' from '.$nameSpace);
          
                  // Convert to linux path, windows will convert it automatically if necessary
          Severity: Minor
          Found in src/deprecated/AutoLoader.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 replaceInterfaceDependencies has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function replaceInterfaceDependencies(array $metadataCollection) {
          
                  $list = [];
                  $listPath = [];
                  /** @var ClassMetadata $classMetadata */
          Severity: Major
          Found in src/loader/ContainerManager.php - About 2 hrs to fix

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

                public function buildXMLConfig(array $classesMetadata, string $path)
                {
                    foreach ($classesMetadata as $alias => $classMetadata) {
                        $dom = new \DOMDocument("1.0", "utf-8");
                        $dom->preserveWhiteSpace = false;
            Severity: Minor
            Found in src/XMLBuilder.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

            Consider simplifying this complex logical expression.
            Open

                        if (file_exists($classPath)
                            && !preg_match('/\/api\/generated\//', $className)
                            && !preg_match('/activerecord\/dbQuery/', $className)
                            && !preg_match('/samson\/activerecord\//', $className)
                            && !preg_match('/Field.php$/', $classPath)
            Severity: Critical
            Found in src/loader/module/Module.php - About 2 hrs to fix

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

                  public function getModule(string $moduleName) : Module
                  {
                      // Check if module exists
                      if (!array_key_exists($moduleName, $this->composerModules)) {
                          throw new \Exception(sprintf('Module with name "%s" not found', $moduleName));
              Severity: Minor
              Found in src/loader/module/ComposerModuleManager.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 buildXMLConfig has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function buildXMLConfig(array $classesMetadata, string $path)
                  {
                      foreach ($classesMetadata as $alias => $classMetadata) {
                          $dom = new \DOMDocument("1.0", "utf-8");
                          $dom->preserveWhiteSpace = false;
              Severity: Minor
              Found in src/XMLBuilder.php - About 1 hr to fix

                Function prepareModules has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function prepareModules(array $modules, $container)
                    {
                        foreach ($modules as $module) {
                            $identifier = $module->name;
                            if ($module->className) {
                Severity: Minor
                Found in src/loader/CoreLoader.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 copy has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function copy($path, $dest)
                    {
                        // Если это папка
                        if (is_dir($path)) {
                            // Создадим папку в том месте куда нужно копировать, если её там нет
                Severity: Minor
                Found in src/File.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 oldModule has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected static function oldModule($className, $nameSpace, & $file = null)
                    {
                        //elapsed('++ Autoloading '.$value.' from '.$nameSpace);
                
                        // Convert to linux path, windows will convert it automatically if necessary
                Severity: Minor
                Found in src/deprecated/AutoLoader.php - About 1 hr to fix

                  Function debug_parse_args has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function & debug_parse_args(array $args)
                  {
                      // Соберем сюда описание аргументов функции
                      $result = array();
                  
                  
                  Severity: Minor
                  Found in src/Utils2.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 render has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function render($view, $data = array())
                      {
                          // TODO: Make rendering as external system, to split up these 3 rendering options
                  
                          // Объявить ассоциативный массив переменных в данном контексте
                  Severity: Minor
                  Found in src/Core.php - About 1 hr to fix

                    Method getModule has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getModule(string $moduleName) : Module
                        {
                            // Check if module exists
                            if (!array_key_exists($moduleName, $this->composerModules)) {
                                throw new \Exception(sprintf('Module with name "%s" not found', $moduleName));
                    Severity: Minor
                    Found in src/loader/module/ComposerModuleManager.php - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language