YetiForceCompany/YetiForceCRM

View on GitHub
app/Exceptions/NoPermittedToApi.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

__construct accesses the super-global variable $_REQUEST.
Open

    public function __construct($message = '', $code = 406, \Throwable $previous = null)
    {
        parent::__construct($message, $code, $previous);
        \App\Session::init();
        \Api\Core\Request::init();
Severity: Minor
Found in app/Exceptions/NoPermittedToApi.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

__construct accesses the super-global variable $_REQUEST.
Open

    public function __construct($message = '', $code = 406, \Throwable $previous = null)
    {
        parent::__construct($message, $code, $previous);
        \App\Session::init();
        \Api\Core\Request::init();
Severity: Minor
Found in app/Exceptions/NoPermittedToApi.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Missing class import via use statement (line '30', column '35').
Open

                'request' => json_encode((new \App\Anonymization())->setModuleName($_REQUEST['module'] ?? '')->setData($_REQUEST)->anonymize()->getData()),
Severity: Minor
Found in app/Exceptions/NoPermittedToApi.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

Avoid using static access to class '\App\TextUtils' in method '__construct'.
Open

                'url' => \App\TextUtils::textTruncate(\App\RequestUtil::getBrowserInfo()->url, 300, false),
Severity: Minor
Found in app/Exceptions/NoPermittedToApi.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 '\App\TextUtils' in method '__construct'.
Open

                'ip' => \App\TextUtils::textTruncate(\App\RequestUtil::getRemoteIP(), 100, false),
Severity: Minor
Found in app/Exceptions/NoPermittedToApi.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 '\App\RequestUtil' in method '__construct'.
Open

                'ip' => \App\TextUtils::textTruncate(\App\RequestUtil::getRemoteIP(), 100, false),
Severity: Minor
Found in app/Exceptions/NoPermittedToApi.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 '\App\Session' in method '__construct'.
Open

        $userName = \App\Session::get('full_user_name');
Severity: Minor
Found in app/Exceptions/NoPermittedToApi.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 '\App\Request' in method '__construct'.
Open

                'agent' => \App\TextUtils::textTruncate(\App\Request::_getServer('HTTP_USER_AGENT', '-'), 500, false),
Severity: Minor
Found in app/Exceptions/NoPermittedToApi.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 '\App\Session' in method '__construct'.
Open

        \App\Session::init();
Severity: Minor
Found in app/Exceptions/NoPermittedToApi.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 '\App\TextUtils' in method '__construct'.
Open

                'agent' => \App\TextUtils::textTruncate(\App\Request::_getServer('HTTP_USER_AGENT', '-'), 500, false),
Severity: Minor
Found in app/Exceptions/NoPermittedToApi.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 '\Api\Core\Request' in method '__construct'.
Open

        \Api\Core\Request::init();
Severity: Minor
Found in app/Exceptions/NoPermittedToApi.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

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

        \App\Db::getInstance('log')->createCommand()
Severity: Critical
Found in app/Exceptions/NoPermittedToApi.php by phan

Spaces must be used to indent lines; tabs are not allowed
Open

        $userName = \App\Session::get('full_user_name');

Spaces must be used to indent lines; tabs are not allowed
Open

            ->insert('o_#__access_for_api', [

Spaces must be used to indent lines; tabs are not allowed
Open

        \App\Session::init();

Spaces must be used to indent lines; tabs are not allowed
Open

                'request' => json_encode((new \App\Anonymization())->setModuleName($_REQUEST['module'] ?? '')->setData($_REQUEST)->anonymize()->getData()),

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

        parent::__construct($message, $code, $previous);

Spaces must be used to indent lines; tabs are not allowed
Open

        \Api\Core\Request::init();

Spaces must be used to indent lines; tabs are not allowed
Open

        \App\Db::getInstance('log')->createCommand()

Spaces must be used to indent lines; tabs are not allowed
Open

            ])->execute();

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $message

Spaces must be used to indent lines; tabs are not allowed
Open

    public function __construct($message = '', $code = 406, \Throwable $previous = null)

Spaces must be used to indent lines; tabs are not allowed
Open

     * Display message.

Spaces must be used to indent lines; tabs are not allowed
Open

                'url' => \App\TextUtils::textTruncate(\App\RequestUtil::getBrowserInfo()->url, 300, false),

Spaces must be used to indent lines; tabs are not allowed
Open

                'agent' => \App\TextUtils::textTruncate(\App\Request::_getServer('HTTP_USER_AGENT', '-'), 500, false),

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

                'date' => date('Y-m-d H:i:s'),

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

                'ip' => \App\TextUtils::textTruncate(\App\RequestUtil::getRemoteIP(), 100, false),

Spaces must be used to indent lines; tabs are not allowed
Open

        echo json_encode($message);

Line exceeds 120 characters; contains 155 characters
Open

                'request' => json_encode((new \App\Anonymization())->setModuleName($_REQUEST['module'] ?? '')->setData($_REQUEST)->anonymize()->getData()),

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

                'username' => empty($userName) ? '-' : $userName,

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

    public function stop(string $message)

Spaces must be used to indent lines; tabs are not allowed
Open

    }

There are no issues that match your filters.

Category
Status