gjerokrsteski/pimf-framework

View on GitHub

Showing 37 of 37 total issues

ResponseStatus has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class ResponseStatus
{
    /**
     * Name and revision of the information protocol
     *
Severity: Minor
Found in core/Pimf/Util/Header/ResponseStatus.php - About 3 hrs to fix

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

        public function render()
        {
            if (Sapi::isCli() && Config::get('environment') == 'production') {
                $suffix = 'CliAction';
                $action = $this->request->fromCli()->get('action', 'index');
    Severity: Minor
    Found in core/Pimf/Controller/Base.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 initCliAction has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function initCliAction()
        {
            clearstatcache();
    
            $app = 'app/' . Config::get('app.name') . '/';
    Severity: Minor
    Found in core/Pimf/Controller/Core.php - About 1 hr to fix

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

          public static function format(\Exception $exception, $isCli = false)
          {
              if ($isCli === true) {
                  return
                      "+++ Untreated Exception +++" . PHP_EOL . "Message: " . $exception->getMessage() . PHP_EOL . "Location: " . $exception->getFile()
      Severity: Minor
      Found in core/Pimf/Error.php - About 1 hr to fix

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

            public static function fire($events, $parameters = array(), $halt = false)
            {
                $responses = array();
                $parameters = (array)$parameters;
        
        
        Severity: Minor
        Found in core/Pimf/Event.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 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function render()
            {
                if (Sapi::isCli() && Config::get('environment') == 'production') {
                    $suffix = 'CliAction';
                    $action = $this->request->fromCli()->get('action', 'index');
        Severity: Minor
        Found in core/Pimf/Controller/Base.php - About 1 hr to fix

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

          <?php
          /**
           * Pimf
           *
           * @copyright Copyright (c)  Gjero Krsteski (http://krsteski.de)
          Severity: Major
          Found in core/Pimf/Session/Storages/Redis.php and 2 other locations - About 1 hr to fix
          core/Pimf/Session/Storages/Apc.php on lines 1..61
          core/Pimf/Session/Storages/Memcached.php on lines 1..63

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 86.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

          <?php
          /**
           * Pimf
           *
           * @copyright Copyright (c)  Gjero Krsteski (http://krsteski.de)
          Severity: Major
          Found in core/Pimf/Session/Storages/Apc.php and 2 other locations - About 1 hr to fix
          core/Pimf/Session/Storages/Memcached.php on lines 1..63
          core/Pimf/Session/Storages/Redis.php on lines 1..63

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 86.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

          <?php
          /**
           * Pimf
           *
           * @copyright Copyright (c)  Gjero Krsteski (http://krsteski.de)
          Severity: Major
          Found in core/Pimf/Session/Storages/Memcached.php and 2 other locations - About 1 hr to fix
          core/Pimf/Session/Storages/Apc.php on lines 1..61
          core/Pimf/Session/Storages/Redis.php on lines 1..63

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 86.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

              public function init()
              {
                  //convert URL params into regex patterns, construct a regex for this route, load params
                  $regex = preg_replace_callback(
                      '#:([\w]+)\+?#', array($this, 'computeUrlRegex'), str_replace(')', ')?', (string)$this->rule)
          Severity: Minor
          Found in core/Pimf/Route.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 setupUtils has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function setupUtils(array $server, $tmpPath, $logging = 'file')
              {
                  self::$env = new Environment($server);
                  $envData = self::$env->data();
          
          
          Severity: Minor
          Found in core/Pimf/Application.php - About 1 hr to fix

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

                public function __construct(\Pimf\Request $request, $repositoryPath = '/Controller', $prefix = 'Pimf\\', $router)
                {
                    $controllerName = $request->fromGet()->get('controller');
                    $this->router = $router;
            
            
            Severity: Minor
            Found in core/Pimf/Resolver.php - About 1 hr to fix

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

                  public static function run(array $get, array $post, array $cookie, array $files)
                  {
                      $cli = array();
                      if (Sapi::isCli()) {
                          $cli = Cli::parse((array)self::$env->argv);
              Severity: Minor
              Found in core/Pimf/Application.php - About 1 hr to fix

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

                    public static function native($code, $error, $file, $line, Logger $logger, $reporting, $exit = true)
                Severity: Major
                Found in core/Pimf/Error.php - About 50 mins to fix

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

                      protected static function view($code, $status, $exit = true)
                      {
                          if (Sapi::isCli()) {
                              echo $status . PHP_EOL;
                              if ($exit) {
                  Severity: Minor
                  Found in core/Pimf/Util/Header.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 put has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public static function put($name, $value, $expiration = 0, $path = '/', $domain = null, $secure = false)
                  Severity: Minor
                  Found in core/Pimf/Cookie.php - About 45 mins to fix

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

                            Request $request,
                            Response $response = null,
                            Logger $logger,
                            $em,
                            Router $router,
                    Severity: Minor
                    Found in core/Pimf/Controller/Base.php - About 45 mins to fix

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

                          public function __construct(\Pimf\Request $request, $repositoryPath = '/Controller', $prefix = 'Pimf\\', $router)
                          {
                              $controllerName = $request->fromGet()->get('controller');
                              $this->router = $router;
                      
                      
                      Severity: Minor
                      Found in core/Pimf/Resolver.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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              array $getData,
                              array $postData = array(),
                              array $cookieData = array(),
                              array $cliData = array(),
                              array $filesData = array(),
                      Severity: Minor
                      Found in core/Pimf/Request.php - About 45 mins to fix

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

                            public function __construct($path, $name, $mime = null, $size = null, $error = null, $test = false)
                        Severity: Minor
                        Found in core/Pimf/Util/Uploaded.php - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language