YetiForceCompany/YetiForceCRM

View on GitHub
api/webservice/ManageConsents/BaseAction.php

Summary

Maintainability
A
0 mins
Test Coverage
A
92%

Missing class import via use statement (line '57', column '20').
Open

        $userData = (new \App\Db\Query())

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

Missing class import via use statement (line '66', column '14').
Open

            throw new \Api\Core\Exception('Invalid data access', 401);

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

Avoid using static access to class '\App\Db' in method 'checkPermission'.
Open

        $db = \App\Db::getInstance('webservice');

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 '\App\User' in method 'checkPermission'.
Open

        \App\User::setCurrentUserId($userData['user_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

Call to undeclared method \App\Db::createCommand
Open

        $db->createCommand()->update($userTable, ['login_time' => date('Y-m-d H:i:s')], ['id' => $userData['id']])->execute();

Call to undeclared method \App\Db\Query::from
Open

        $userData = (new \App\Db\Query())

Call to method setCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
Open

        \App\User::setCurrentUserId($userData['user_id']);

Possibly zero references to use statement for classlike/namespace OA (\OpenApi\Annotations)
Open

use OpenApi\Annotations as OA;

Avoid variables with short names like $db. Configured minimum length is 3.
Open

        $db = \App\Db::getInstance('webservice');

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Spaces must be used for alignment; tabs are not allowed
Open

 *         title="YetiForce API for Webservice App. Type: Manage consents",

Spaces must be used for alignment; tabs are not allowed
Open

 *       ),

Spaces must be used for alignment; tabs are not allowed
Open

            ->limit(1)->one($db);

Spaces must be used for alignment; tabs are not allowed
Open

 *        url="https://gitdeveloper.yetiforce.com",

Spaces must be used for alignment; tabs are not allowed
Open

 *        description="Demo server of the development version",

Spaces must be used for alignment; tabs are not allowed
Open

            ])

Spaces must be used for alignment; tabs are not allowed
Open

    }

Spaces must be used for alignment; tabs are not allowed
Open

 *         version="0.2",

Spaces must be used for alignment; tabs are not allowed
Open

 *            name="YetiForce Public License",

Spaces must be used for alignment; tabs are not allowed
Open

    protected function checkPermission(): void

Spaces must be used for alignment; tabs are not allowed
Open

                'token' => $this->controller->request->getHeader('x-token'),

Spaces must be used for alignment; tabs are not allowed
Open

        $this->setAllUserData($userData);

Spaces must be used for alignment; tabs are not allowed
Open

        $db->createCommand()->update($userTable, ['login_time' => date('Y-m-d H:i:s')], ['id' => $userData['id']])->execute();

Spaces must be used for alignment; tabs are not allowed
Open

    public function updateSession(array $data = []): void

Spaces must be used for alignment; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used for alignment; tabs are not allowed
Open

 * @license     YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)

Spaces must be used for alignment; tabs are not allowed
Open

        }

Spaces must be used for alignment; tabs are not allowed
Open

 *         description="Skip the `/webservice` fragment for connections via ApiProxy. There are two ways to connect to API, with or without rewrite, below are examples of both:

Spaces must be used for alignment; tabs are not allowed
Open

 *             name="Devs API Team",

Spaces must be used for alignment; tabs are not allowed
Open

 *        url="https://gitstable.yetiforce.com",

Spaces must be used for alignment; tabs are not allowed
Open

    }

Spaces must be used for alignment; tabs are not allowed
Open

 *             email="devs@yetiforce.com",

Spaces must be used for alignment; tabs are not allowed
Open

    {

Spaces must be used for alignment; tabs are not allowed
Open

 *             url="https://yetiforce.com/en/yetiforce/license"

Spaces must be used for alignment; tabs are not allowed
Open

            ->from($userTable)

Spaces must be used for alignment; tabs are not allowed
Open

        if (!$userData) {

Spaces must be used for alignment; tabs are not allowed
Open

 *        description="Demo server of the latest stable version",

Spaces must be used for alignment; tabs are not allowed
Open

        $db = \App\Db::getInstance('webservice');

Spaces must be used for alignment; tabs are not allowed
Open

        $userData = (new \App\Db\Query())

Spaces must be used for alignment; tabs are not allowed
Open

 *       @OA\Contact(

Spaces must be used for alignment; tabs are not allowed
Open

        $userTable = 'w_#__manage_consents_user';

Spaces must be used for alignment; tabs are not allowed
Open

            ->where([

Spaces must be used for alignment; tabs are not allowed
Open

                'status' => 1,

Spaces must be used for alignment; tabs are not allowed
Open

 *         termsOfService="https://yetiforce.com/",

Spaces must be used for alignment; tabs are not allowed
Open

 *             url="https://yetiforce.com/"

Spaces must be used for alignment; tabs are not allowed
Open

 *        ),

Spaces must be used for alignment; tabs are not allowed
Open

        \App\User::setCurrentUserId($userData['user_id']);

Spaces must be used for alignment; tabs are not allowed
Open

 *       @OA\License(

Spaces must be used for alignment; tabs are not allowed
Open

    /** {@inheritdoc}  */

Spaces must be used for alignment; tabs are not allowed
Open

                'server_id' => $this->controller->app['id'],

Spaces must be used for alignment; tabs are not allowed
Open

            throw new \Api\Core\Exception('Invalid data access', 401);

Spaces must be used for alignment; tabs are not allowed
Open

    {

Line exceeds 120 characters; contains 173 characters
Open

 *         description="Skip the `/webservice` fragment for connections via ApiProxy. There are two ways to connect to API, with or without rewrite, below are examples of both:

Line exceeds 120 characters; contains 126 characters
Open

        $db->createCommand()->update($userTable, ['login_time' => date('Y-m-d H:i:s')], ['id' => $userData['id']])->execute();

There are no issues that match your filters.

Category
Status