immense/php-macaroons

View on GitHub

Showing 65 of 65 total issues

Avoid using static access to class 'Macaroons\Utils' in method 'verifyDischarge'.
Open

      $this->calculatedSignature = $rootMacaroon->bindSignature(strtolower(Utils::hexlify($this->calculatedSignature)));
Severity: Minor
Found in lib/Macaroons/Verifier.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Macaroons\Utils' in method '__toString'.
Open

      $caveatAsArray['vid'] = Utils::hexlify($caveatAsArray['vid']);
Severity: Minor
Found in lib/Macaroons/Caveat.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Macaroons\Utils' in method 'getSignature'.
Open

    return strtolower( Utils::hexlify( $this->signature ) );
Severity: Minor
Found in lib/Macaroons/Macaroon.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Macaroons\Utils' in method 'initialSignature'.
Open

    return Utils::hmac( Utils::generateDerivedKey($key), $identifier);
Severity: Minor
Found in lib/Macaroons/Macaroon.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

The method verifyFirstPartyCaveat uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

    {
      foreach ($this->callbacks as $callback)
      {
        if ($callback($caveat->getCaveatId()))
          $caveatMet = true;
Severity: Minor
Found in lib/Macaroons/Verifier.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid using static access to class 'Macaroons\Utils' in method 'verifyThirdPartyCaveat'.
Open

      $this->calculatedSignature = Utils::signThirdPartyCaveat(
                                                                $this->calculatedSignature,
                                                                $caveat->getVerificationId(),
                                                                $caveat->getCaveatId()
                                                              );
Severity: Minor
Found in lib/Macaroons/Verifier.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Macaroons\Utils' in method 'verify'.
Open

    $key = Utils::generateDerivedKey($key);
Severity: Minor
Found in lib/Macaroons/Verifier.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Macaroons\Utils' in method 'addThirdPartyCaveat'.
Open

    $truncatedOrPaddedSignature = Utils::truncateOrPad( $this->signature );
Severity: Minor
Found in lib/Macaroons/Macaroon.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Macaroons\Utils' in method 'fromJSON'.
Open

    $m->setSignature(Utils::unhexlify($signature));
Severity: Minor
Found in lib/Macaroons/Macaroon.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Macaroons\Utils' in method 'verifyDischarge'.
Open

    $this->calculatedSignature = Utils::hmac($key, $macaroon->getIdentifier());
Severity: Minor
Found in lib/Macaroons/Verifier.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Macaroons\Utils' in method 'extractCaveatKey'.
Open

    $key              = Utils::truncateOrPad($signature);
Severity: Minor
Found in lib/Macaroons/Verifier.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Macaroons\Utils' in method 'bindSignature'.
Open

    $currentSignatureHash = Utils::hmac($key, Utils::unhexlify($this->getSignature()));
Severity: Minor
Found in lib/Macaroons/Macaroon.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Macaroons\Utils' in method 'bindSignature'.
Open

    $newSignatureHash     = Utils::hmac($key, Utils::unhexlify($signature));
Severity: Minor
Found in lib/Macaroons/Macaroon.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Macaroons\Utils' in method 'initialSignature'.
Open

    return Utils::hmac( Utils::generateDerivedKey($key), $identifier);
Severity: Minor
Found in lib/Macaroons/Macaroon.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Macaroons\Utils' in method 'deserialize'.
Open

    $decoded    = Utils::base64_url_decode($serialized);
Severity: Minor
Found in lib/Macaroons/Macaroon.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

The variable $verification_id_hmac is not named in camelCase.
Open

  public static function signThirdPartyCaveat($signature, $verificationId, $caveatId)
  {
    $verification_id_hmac = self::hmac($signature, $verificationId);
    $caveat_id_hmac       = self::hmac($signature, $caveatId);
    $combined             = $verification_id_hmac . $caveat_id_hmac;
Severity: Minor
Found in lib/Macaroons/Utils.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $caveat_id_hmac is not named in camelCase.
Open

  public static function signThirdPartyCaveat($signature, $verificationId, $caveatId)
  {
    $verification_id_hmac = self::hmac($signature, $verificationId);
    $caveat_id_hmac       = self::hmac($signature, $caveatId);
    $combined             = $verification_id_hmac . $caveat_id_hmac;
Severity: Minor
Found in lib/Macaroons/Utils.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $verification_id_hmac is not named in camelCase.
Open

  public static function signThirdPartyCaveat($signature, $verificationId, $caveatId)
  {
    $verification_id_hmac = self::hmac($signature, $verificationId);
    $caveat_id_hmac       = self::hmac($signature, $caveatId);
    $combined             = $verification_id_hmac . $caveat_id_hmac;
Severity: Minor
Found in lib/Macaroons/Utils.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $caveat_id_hmac is not named in camelCase.
Open

  public static function signThirdPartyCaveat($signature, $verificationId, $caveatId)
  {
    $verification_id_hmac = self::hmac($signature, $verificationId);
    $caveat_id_hmac       = self::hmac($signature, $caveatId);
    $combined             = $verification_id_hmac . $caveat_id_hmac;
Severity: Minor
Found in lib/Macaroons/Utils.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The method base64_url_safe_encode is not named in camelCase.
Open

  public static function base64_url_safe_encode($data)
  {
    $data = str_replace('+', '-', self::base64_strict_encode($data));
    return str_replace('/', '_', $data);
  }
Severity: Minor
Found in lib/Macaroons/Utils.php by phpmd

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

Severity
Category
Status
Source
Language