elcodedocle/captchalot

View on GitHub

Showing 21 of 21 total issues

File top10000.php has 10003 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
$validSymbols = array(
    'the',
    'of',
    'and',
Severity: Major
Found in top10000.php - About 1 mo to fix

    Method createImage has 110 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function createImage($word, $width = null, $height = null){
    
            if (!is_int($width)){
                $width = $this->defaultWidth;
            }
    Severity: Major
    Found in captchaimage.php - About 4 hrs to fix

      Function generateTrie has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          private function generateTrie(&$validSymbols){
      
              if (is_string($validSymbols)){
                  $validSymbols = array($validSymbols);
              }
      Severity: Minor
      Found in captchaword.php - About 3 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 __construct has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __construct(
              $defaultInternalOrExternalSymbols = null, 
              $defaultLength = null, 
              $useExternalSymbolsArray = true,
              $prng = null
      Severity: Minor
      Found in captchaword.php - About 3 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 validate has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          'validate' : function(opts){
      
              var XHR = new XMLHttpRequest(),
                  responseJSON,
                  parameters,
      Severity: Major
      Found in webapp/captchalot.js - About 2 hrs to fix

        Method generateTrie has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function generateTrie(&$validSymbols){
        
                if (is_string($validSymbols)){
                    $validSymbols = array($validSymbols);
                }
        Severity: Minor
        Found in captchaword.php - About 1 hr to fix

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

              public function validate($uuid, $word, $ip = null){
                  if ($ip === null){
                      $ip = $this->ip;
                  }
                  if ($ip === false){
          Severity: Minor
          Found in captcha.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 __construct has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function __construct($sessionId, $dbh = null, $dBParams = null, $tableName = 'captchalot'){
          
                  if (!isset($sessionId)||!is_string($sessionId)||strlen($sessionId)<1){
                      throw new Exception(
                          'Invalid session id.',
          Severity: Minor
          Found in session.php - About 1 hr to fix

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

                public function createImage($word, $width = null, $height = null){
            
                    if (!is_int($width)){
                        $width = $this->defaultWidth;
                    }
            Severity: Minor
            Found in captchaimage.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 __construct has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function __construct(
                    $defaultInternalOrExternalSymbols = null, 
                    $defaultLength = null, 
                    $useExternalSymbolsArray = true,
                    $prng = null
            Severity: Minor
            Found in captchaword.php - About 1 hr to fix

              Method validate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function validate($uuid, $word, $ip = null){
                      if ($ip === null){
                          $ip = $this->ip;
                      }
                      if ($ip === false){
              Severity: Minor
              Found in captcha.php - About 1 hr to fix

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

                    public function generateWord($symbols = null, $length = null, $separator = '   '){
                        
                        if ($symbols===null){
                            $symbols = $this->defaultSymbols;
                        }
                Severity: Minor
                Found in captchaword.php - About 1 hr to fix

                  Function validateWord has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function validateWord($word, $symbols = null){
                          
                          if ($this->defaultTrie === null){
                              $this->defaultTrie = $this->generateTrie($this->defaultSymbols);
                          }
                  Severity: Minor
                  Found in captchaword.php - About 55 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 generateWord has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function generateWord($symbols = null, $length = null, $separator = '   '){
                          
                          if ($symbols===null){
                              $symbols = $this->defaultSymbols;
                          }
                  Severity: Minor
                  Found in captchaword.php - About 55 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 isValidWord has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function isValidWord($word,&$trie){
                          $nodes = array($word);
                          while (count($nodes)>0){
                              $node = array_shift($nodes);
                              if ($this->inTrie($node,$trie)) { return true; }
                  Severity: Minor
                  Found in captchaword.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 __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function __construct($sessionId, $dbh = null, $dBParams = null, $tableName = 'captchalot'){
                  
                          if (!isset($sessionId)||!is_string($sessionId)||strlen($sessionId)<1){
                              throw new Exception(
                                  'Invalid session id.',
                  Severity: Minor
                  Found in session.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 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function __construct($session, $ip = null, $uuidGenerator = null, $wordGenerator = null, $imageGenerator = null){
                  Severity: Minor
                  Found in captcha.php - About 35 mins to fix

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

                        public function __construct($dBHost, $dBPort, $dBUser, $dBPassword, $dBName){
                    Severity: Minor
                    Found in dbparams.php - About 35 mins to fix

                      Avoid too many return statements within this method.
                      Open

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

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

                            public function echoImage(){
                        
                                $uuid = $this->uuidGenerator->v4();
                                $word = $this->wordGenerator->generateWord();
                                $image = $this->imageGenerator->createImage($word);
                        Severity: Minor
                        Found in captcha.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