Asymptix/Framework

View on GitHub
framework/core/Validator.php

Summary

Maintainability
A
2 hrs
Test Coverage

validateFileUpload accesses the super-global variable $_FILES.
Open

    public static function validateFileUpload($fileFieldName) {
        global $_FILES;

        if (isset($_FILES[$fileFieldName]) && $_FILES[$fileFieldName]['error'] == UPLOAD_ERR_OK) {
            return true;
Severity: Minor
Found in framework/core/Validator.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

validateFileUpload accesses the super-global variable $_FILES.
Open

    public static function validateFileUpload($fileFieldName) {
        global $_FILES;

        if (isset($_FILES[$fileFieldName]) && $_FILES[$fileFieldName]['error'] == UPLOAD_ERR_OK) {
            return true;
Severity: Minor
Found in framework/core/Validator.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

validateFileUpload accesses the super-global variable $_FILES.
Open

    public static function validateFileUpload($fileFieldName) {
        global $_FILES;

        if (isset($_FILES[$fileFieldName]) && $_FILES[$fileFieldName]['error'] == UPLOAD_ERR_OK) {
            return true;
Severity: Minor
Found in framework/core/Validator.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

The class Validator has 20 public methods. Consider refactoring Validator to keep number of public methods under 10.
Open

class Validator {

    /**
     * Validate field value by regular expression.
     *
Severity: Minor
Found in framework/core/Validator.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class Validator has an overall complexity of 54 which is very high. The configured complexity threshold is 50.
Open

class Validator {

    /**
     * Validate field value by regular expression.
     *
Severity: Minor
Found in framework/core/Validator.php by phpmd

Validator has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class Validator {

    /**
     * Validate field value by regular expression.
     *
Severity: Minor
Found in framework/core/Validator.php - About 2 hrs to fix

    Avoid using static access to class 'Asymptix\core\Errors' in method 'validateChecked'.
    Open

                Errors::saveErrorFor($fieldName, \__ERRORS::CHECK_THIS_FIELD);
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateEmail'.
    Open

                Errors::saveErrorFor($fieldName, \__ERRORS::INVALID_EMAIL);
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateUrl'.
    Open

                Errors::saveErrorFor($fieldName, \__ERRORS::URL_EMPTY);
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateTextMinLength'.
    Open

                Errors::saveErrorFor(
                    $fieldName,
                    str_replace("[[1]]", $minTextLength, \__ERRORS::MIN_TEXT_LENGTH)
                );
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validateSignIn'.
    Open

            $login = Request::getFieldValue($loginFieldName);
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateNotEmpty'.
    Open

                Errors::saveErrorFor($fieldName, \__ERRORS::FIELD_CANT_BE_EMPTY);
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateRange'.
    Open

                Errors::saveErrorFor($fieldName, \__ERRORS::INCORRECT_VALUE);
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validatePassword'.
    Open

            $password = trim(Request::getFieldValue($passwordFieldName));
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validatePassword'.
    Open

                Errors::saveErrorFor($passwordFieldName, \__ERRORS::EMPTY_PASSWORD);
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateCaptcha'.
    Open

                Errors::saveErrorFor($fieldName, \__ERRORS::INVALID_CAPTCHA_CODE);
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validateTextMaxLength'.
    Open

            $text = trim(strip_tags(Request::getFieldValue($fieldName)));
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validateChecked'.
    Open

            $fieldValue = trim(Request::getFieldValue($fieldName));
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateSignIn'.
    Open

                Errors::saveErrorFor($passwordFieldName, \__ERRORS::EMPTY_PASSWORD);
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validateEmail'.
    Open

            $fieldValue = trim(Request::getFieldValue($fieldName));
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Tools' in method 'validateInteger'.
    Open

            } elseif (!Tools::isInteger($fieldValue)) {
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateInteger'.
    Open

                Errors::saveErrorFor($fieldName, \__ERRORS::INVALID_INTEGER);
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validateSignIn'.
    Open

            $password = Request::getFieldValue($passwordFieldName);
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validatePassword'.
    Open

            $rePassword = trim(Request::getFieldValue($rePasswordFieldName));
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validateTextMinLength'.
    Open

            $text = trim(strip_tags(Request::getFieldValue($fieldName)));
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validateInteger'.
    Open

            $fieldValue = trim(Request::getFieldValue($fieldName));
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validateNoSpaces'.
    Open

            $fieldValue = Request::getFieldValue($fieldName);
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateSignIn'.
    Open

                Errors::saveErrorFor($loginFieldName, \__ERRORS::EMPTY_LOGIN);
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validateRange'.
    Open

            $fieldValue = Request::getFieldValue($fieldName);
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateNoSpaces'.
    Open

                Errors::saveErrorFor($fieldName, \__ERRORS::SPACES_INACCEPTABLE);
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateEmail'.
    Open

                Errors::saveErrorFor($fieldName, \__ERRORS::INVALID_EMAIL);
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validatePositive'.
    Open

            $fieldValue = trim(Request::getFieldValue($fieldName));
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateInteger'.
    Open

                Errors::saveErrorFor($fieldName, \__ERRORS::FIELD_CANT_BE_EMPTY);
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validateNotEmpty'.
    Open

            $fieldValue = Request::getFieldValue($fieldName);
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validateCaptcha'.
    Open

            if (Request::getFieldValue($fieldName) != Session::get($fieldName)) {
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Session' in method 'validateCaptcha'.
    Open

            if (Request::getFieldValue($fieldName) != Session::get($fieldName)) {
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateFileUpload'.
    Open

            Errors::saveErrorFor($fileFieldName, \__ERRORS::FILE_UPLOAD_ERROR);
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validateDouble'.
    Open

            $fieldValue = trim(Request::getFieldValue($fieldName));
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateDouble'.
    Open

                Errors::saveErrorFor($fieldName, \__ERRORS::FIELD_CANT_BE_EMPTY);
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validatePositive'.
    Open

                Errors::saveErrorFor($fieldName, \__ERRORS::INVALID_POSITIVE);
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validateUrl'.
    Open

            $fieldValue = Request::getFieldValue($fieldName);
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateUrl'.
    Open

                Errors::saveErrorFor($fieldName, \__ERRORS::URL_INVALID);
    Severity: Minor
    Found in framework/core/Validator.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 '\Asymptix\web\Request' in method 'validateEmpty'.
    Open

            $fieldValue = trim(Request::getFieldValue($fieldName));
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validatePassword'.
    Open

                Errors::saveErrorFor($rePasswordFieldName, \__ERRORS::PASSWORDS_ARE_DIFFERENT);
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateTextMaxLength'.
    Open

                Errors::saveErrorFor(
                    $fieldName,
                    str_replace("[[1]]", $maxTextLength, \__ERRORS::MAX_TEXT_LENGTH)
                );
    Severity: Minor
    Found in framework/core/Validator.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 'Asymptix\core\Errors' in method 'validateDouble'.
    Open

                Errors::saveErrorFor($fieldName, \__ERRORS::INVALID_NUMBER);
    Severity: Minor
    Found in framework/core/Validator.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

    There are no issues that match your filters.

    Category
    Status