immense/php-macaroons

View on GitHub

Showing 6 of 65 total issues

Method deserialize has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public static function deserialize($serialized)
  {
    $location   = NULL;
    $identifier = NULL;
    $signature  = NULL;
Severity: Minor
Found in lib/Macaroons/Macaroon.php - About 1 hr to fix

    Method serialize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public function serialize()
      {
        $p = new Packet();
        $s = $p->packetize(
                            array(
    Severity: Minor
    Found in lib/Macaroons/Macaroon.php - About 1 hr to fix

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

        private function verifyThirdPartyCaveat(Caveat $caveat, Macaroon $rootMacaroon, Array $dischargeMacaroons)
        {
          $caveatMet = false;
      
          $dischargesMatchingCaveat = array_filter($dischargeMacaroons, function($discharge) use ($rootMacaroon, $caveat) {
      Severity: Minor
      Found in lib/Macaroons/Verifier.php - About 1 hr to fix

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

          private function verifyCaveats(Macaroon $macaroon, Array $dischargeMacaroons = array())
          {
            foreach ($macaroon->getCaveats() as $caveat)
            {
              $caveatMet = false;
        Severity: Minor
        Found in lib/Macaroons/Verifier.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 deserialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          public static function deserialize($serialized)
          {
            $location   = NULL;
            $identifier = NULL;
            $signature  = NULL;
        Severity: Minor
        Found in lib/Macaroons/Macaroon.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 verifyFirstPartyCaveat has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          private function verifyFirstPartyCaveat(Caveat $caveat)
          {
            $caveatMet = false;
            if (in_array($caveat->getCaveatId(), $this->predicates))
              $caveatMet = true;
        Severity: Minor
        Found in lib/Macaroons/Verifier.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

        Severity
        Category
        Status
        Source
        Language