rhosocial/rho.social

View on GitHub
api.rho.social/modules/v1/helpers/AuthorizationCode.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using static access to class '\common\models\OauthAuthorizationCode' in method 'findUserUuid'.
Open

        $code = OauthAuthorizationCode::findOne(['authorization_code' => $authorization_code]);

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 '\common\models\OauthAuthorizationCode' in method 'check'.
Open

        $model = OauthAuthorizationCode::findOne($code);

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 parameter $redirect_uri is not named in camelCase.
Open

    public static function check($code, $redirect_uri)
    {
        $model = OauthAuthorizationCode::findOne($code);
        if (!$model) {
            throw new BadRequestHttpException('Invalid Authorization Code.', 10021);

CamelCaseParameterName

Since: 0.2

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

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The parameter $authorization_code is not named in camelCase.
Open

    public static function expireAuthorizationCode(OauthAuthorizationCode $authorization_code)
    {
        $authorization_code->expired = 'true';
        return $authorization_code->save();
    }

CamelCaseParameterName

Since: 0.2

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

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The parameter $authorization_code is not named in camelCase.
Open

    public static function findUserUuid($authorization_code)
    {
        $code = OauthAuthorizationCode::findOne(['authorization_code' => $authorization_code]);
        if ($code) {
            return $code->user_uuid;

CamelCaseParameterName

Since: 0.2

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

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

Whitespace found at end of line
Open

     * 

Whitespace found at end of line
Open

     * 

Whitespace found at end of line
Open

     * 

The variable $authorization_code is not named in camelCase.
Open

    public static function expireAuthorizationCode(OauthAuthorizationCode $authorization_code)
    {
        $authorization_code->expired = 'true';
        return $authorization_code->save();
    }

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 $authorization_code is not named in camelCase.
Open

    public static function expireAuthorizationCode(OauthAuthorizationCode $authorization_code)
    {
        $authorization_code->expired = 'true';
        return $authorization_code->save();
    }

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 $authorization_code is not named in camelCase.
Open

    public static function findUserUuid($authorization_code)
    {
        $code = OauthAuthorizationCode::findOne(['authorization_code' => $authorization_code]);
        if ($code) {
            return $code->user_uuid;

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 $redirect_uri is not named in camelCase.
Open

    public static function check($code, $redirect_uri)
    {
        $model = OauthAuthorizationCode::findOne($code);
        if (!$model) {
            throw new BadRequestHttpException('Invalid Authorization Code.', 10021);

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

There are no issues that match your filters.

Category
Status