rhosocial/rho.social

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

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using static access to class '\common\models\OauthClient' in method 'checkId'.
Open

        $model = OauthClient::findOne($client_id);

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

    public static function checkSecret(OauthClient $client, $client_secret)
    {
        if ($client->client_secret !== $client_secret) {
            throw new ForbiddenHttpException("Invalid Client Secret.", 10032);
        }

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

    public static function checkId($client_id)
    {
        $model = OauthClient::findOne($client_id);
        if (!$model) {
            throw new ForbiddenHttpException("Invalid Client Id.", 10031);

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

    public static function checkId($client_id)
    {
        $model = OauthClient::findOne($client_id);
        if (!$model) {
            throw new ForbiddenHttpException("Invalid Client Id.", 10031);

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

    public static function checkSecret(OauthClient $client, $client_secret)
    {
        if ($client->client_secret !== $client_secret) {
            throw new ForbiddenHttpException("Invalid Client Secret.", 10032);
        }

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