immense/php-macaroons

View on GitHub
lib/Macaroons/Utils.php

Summary

Maintainability
A
0 mins
Test Coverage

The class Utils has 13 public methods. Consider refactoring Utils to keep number of public methods under 10.
Open

class Utils
{
  public static function hexlify($value)
  {
    return join('', array_map(function($byte){
Severity: Minor
Found in lib/Macaroons/Utils.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

Missing class import via use statement (line '41', column '17').
Open

      throw new \InvalidArgumentException('Both arguments must be strings');
Severity: Minor
Found in lib/Macaroons/Utils.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

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

The method base64_url_encode is not named in camelCase.
Open

  public static function base64_url_encode($data)
  {
    return str_replace('=', '', self::base64_url_safe_encode($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

The method base64_url_decode is not named in camelCase.
Open

  public static function base64_url_decode($data)
  {
    return self::base64_url_safe_decode(str_pad($data, (4 - (strlen($data) % 4)) % 4, '=', STR_PAD_RIGHT));
  }
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

The method base64_strict_encode is not named in camelCase.
Open

  public static function base64_strict_encode($data)
  {
    $data = str_replace("\r\n", '', base64_encode($data));
    $data = str_replace("\r", '', $data);
    return str_replace("\n", '', $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

The method base64_url_safe_decode is not named in camelCase.
Open

  public static function base64_url_safe_decode($data)
  {
    $data = str_replace('-', '+', $data);
    $data = str_replace('_', '/', $data);
    return base64_decode($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

There are no issues that match your filters.

Category
Status