YetiForceCompany/YetiForceCRM

View on GitHub
modules/MultiCompany/files/Logo.php

Summary

Maintainability
A
0 mins
Test Coverage
B
89%

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

            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED');
Severity: Minor
Found in modules/MultiCompany/files/Logo.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

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

            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED');
Severity: Minor
Found in modules/MultiCompany/files/Logo.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\Fields\File' in method 'get'.
Open

        $file = \App\Fields\File::loadFromInfo([
            'path' => ROOT_DIRECTORY . DIRECTORY_SEPARATOR . $logo['path'],
            'name' => $logo['name'],
        ]);
Severity: Minor
Found in modules/MultiCompany/files/Logo.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\User' in method 'get'.
Open

        $userModel = \App\User::getUserModel($request->getInteger('record'));
Severity: Minor
Found in modules/MultiCompany/files/Logo.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 'getCheckPermission'.
Open

        if (!App\Session::has('authenticated_user_id') || $request->isEmpty('record', true) || $request->isEmpty('key', true)) {
Severity: Minor
Found in modules/MultiCompany/files/Logo.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 method getUserModel from undeclared class \App\User (Did you mean class \Tests\App\User)
Open

        $userModel = \App\User::getUserModel($request->getInteger('record'));
Severity: Critical
Found in modules/MultiCompany/files/Logo.php by phan

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class MultiCompany_Logo_File extends Vtiger_Basic_File

The class MultiCompany_Logo_File is not named in CamelCase.
Open

class MultiCompany_Logo_File extends Vtiger_Basic_File
{
    /** {@inheritdoc} */
    public $storageName = 'MultiCompany';

Severity: Minor
Found in modules/MultiCompany/files/Logo.php by phpmd

CamelCaseClassName

Since: 0.2

It is considered best practice to use the CamelCase notation to name classes.

Example

class class_name {
}

Source

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

     * @throws \App\Exceptions\NoPermitted

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

    public function get(App\Request $request)

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

            'name' => $logo['name'],

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

        header('pragma: public');

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

        if (!App\Session::has('authenticated_user_id') || $request->isEmpty('record', true) || $request->isEmpty('key', true)) {

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

            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED');

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

     *

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

        $userModel = \App\User::getUserModel($request->getInteger('record'));

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

        header('content-length: ' . $file->getSize());

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

    public function getCheckPermission(App\Request $request)

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

        $file = \App\Fields\File::loadFromInfo([

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

        header('content-transfer-encoding: binary');

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

    public $storageName = 'MultiCompany';

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

     * Get company logo.

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

     * @param \App\Request $request

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

    {

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

        header('content-type: ' . $file->getMimeType());

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

            'path' => ROOT_DIRECTORY . DIRECTORY_SEPARATOR . $logo['path'],

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

        readfile($file->getPath());

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

     * @throws \App\Exceptions\IllegalValue

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

            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED');

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

        }

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

        ]);

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

        }

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

    }

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

        header('cache-control: max-age=86400, public');

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

        header('expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 86400));

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

    }

Line exceeds 120 characters; contains 128 characters
Open

        if (!App\Session::has('authenticated_user_id') || $request->isEmpty('record', true) || $request->isEmpty('key', true)) {

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

    /**

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

        return true;

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

     *

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

        $logo = $userModel->get('multiCompanyLogo');

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

     */

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

        if (!$logo || ($logo['key'] !== $request->getByType('key', 2))) {

Class name "MultiCompany_Logo_File" is not in camel caps format
Open

class MultiCompany_Logo_File extends Vtiger_Basic_File

There are no issues that match your filters.

Category
Status