XoopsModules25x/xoopsinfo

View on GitHub
phpsecinfo/PhpSecInfo/Test/Core/version.php

Summary

Maintainability
A
1 hr
Test Coverage

Method _retrieveCurrentVersions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function _retrieveCurrentVersions()
    {
        if (!function_exists('curl_init')) {
            // Override the OK Message - Even if this passes we can't be 100% sure they are accurate since we didn't fetch the latest version
            $this->_message_ok = 'You are running a current stable version of PHP!
Severity: Minor
Found in phpsecinfo/PhpSecInfo/Test/Core/version.php - About 1 hr to fix

    Avoid unused local variables such as '$timeout'.
    Open

            $timeout = 5;

    UnusedLocalVariable

    Since: 0.2

    Detects when a local variable is declared and/or assigned, but not used.

    Example

    class Foo {
        public function doSomething()
        {
            $i = 5; // Unused
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

    HACK found
    Open

            // HACK: Force to grab current versions - this will fetch the latest version

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

    class PhpSecInfo_Test_Core_Version extends PhpSecInfo_Test_Core

    The property $test_name is not named in camelCase.
    Open

    class PhpSecInfo_Test_Core_Version extends PhpSecInfo_Test_Core
    {
        /**
         * This should be a <b>unique</b>, human-readable identifier for this test
         *

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The class PhpSecInfo_Test_Core_Version is not named in CamelCase.
    Open

    class PhpSecInfo_Test_Core_Version extends PhpSecInfo_Test_Core
    {
        /**
         * This should be a <b>unique</b>, human-readable identifier for this test
         *

    CamelCaseClassName

    Since: 0.2

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

    Example

    class class_name {
    }

    Source

    The property $last_eol_value is not named in camelCase.
    Open

    class PhpSecInfo_Test_Core_Version extends PhpSecInfo_Test_Core
    {
        /**
         * This should be a <b>unique</b>, human-readable identifier for this test
         *

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $_message_ok is not named in camelCase.
    Open

    class PhpSecInfo_Test_Core_Version extends PhpSecInfo_Test_Core
    {
        /**
         * This should be a <b>unique</b>, human-readable identifier for this test
         *

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $recommended_value is not named in camelCase.
    Open

    class PhpSecInfo_Test_Core_Version extends PhpSecInfo_Test_Core
    {
        /**
         * This should be a <b>unique</b>, human-readable identifier for this test
         *

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

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

            $ch = curl_init();

    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

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 24 and the first side effect is on line 16.
    Open

    <?php

    Method name "_retrieveCurrentVersions" should not be prefixed with an underscore to indicate visibility
    Open

        public function _retrieveCurrentVersions()

    Property name "$_message_ok" should not be prefixed with an underscore to indicate visibility
    Open

        private $_message_ok = 'You are running a current stable version of PHP!';

    Method name "_retrieveCurrentValue" should not be prefixed with an underscore to indicate visibility
    Open

        public function _retrieveCurrentValue()

    Method name "_execTest" should not be prefixed with an underscore to indicate visibility
    Open

        public function _execTest()

    Method name "_setMessages" should not be prefixed with an underscore to indicate visibility
    Open

        public function _setMessages()

    Only one argument is allowed per line in a multi-line function call
    Open

            $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en',

    Line exceeds 120 characters; contains 153 characters
    Open

                            <br /><strong>NOTE:</strong> CURL was unable to fetch the latest PHP Versions from the internet. This test may not be accurate if

    Line exceeds 120 characters; contains 128 characters
    Open

        // Cette ligne ne semble pas influencer la version recommandée qui est gérée depuis le fichier .version.json directement.

    Line exceeds 120 characters; contains 141 characters
    Open

                // Override the OK Message - Even if this passes we can't be 100% sure they are accurate since we didn't fetch the latest version

    Line exceeds 120 characters; contains 141 characters
    Open

            $uri = 'https://raw.githubusercontent.com/ZerooCool/phpsecinfo/phpsecinfo-zeroocool-v0.2.1/20070406-phpsecinfo-v0.2.1/.version.json';

    Line exceeds 120 characters; contains 219 characters
    Open

                                       'You are running a version of PHP that is not the most recent and may be near End of Life for support.  You should begin to migrate to the latest version of PHP as soon as possible.');

    Line exceeds 120 characters; contains 140 characters
    Open

            if (version_compare($this->current_value, $version['stable'], '<') && version_compare($this->current_value, $version['eol'], '>')) {

    Line exceeds 120 characters; contains 140 characters
    Open

            // Mettre à jour la valeur recommandée locale (elle est utilisée ailleurs et nous ne voulons pas modifier ce code pour l'instant)

    Line exceeds 120 characters; contains 153 characters
    Open

                            <br /><strong>NOTE:</strong> CURL was unable to fetch the latest PHP Versions from the internet. This test may not be accurate if

    Line exceeds 120 characters; contains 210 characters
    Open

            $this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', 'You are running a version of PHP that has reached End of Life for support.  You should upgrade to the latest version of PHP immediately.');

    Line exceeds 120 characters; contains 141 characters
    Open

                // Override the OK Message - Even if this passes we can't be 100% sure they are accurate since we didn't fetch the latest version

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

    class PhpSecInfo_Test_Core_Version extends PhpSecInfo_Test_Core

    Opening parenthesis of a multi-line function call must be the last content on the line
    Open

            $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en',

    Closing parenthesis of a multi-line function call must be on a line by itself
    Open

                                       'You are running a version of PHP that is not the most recent and may be near End of Life for support.  You should begin to migrate to the latest version of PHP as soon as possible.');

    Multi-line function call not indented correctly; expected 8 spaces but found 35
    Open

                                       'You are running a version of PHP that is not the most recent and may be near End of Life for support.  You should begin to migrate to the latest version of PHP as soon as possible.');

    The method _retrieveCurrentVersions is not named in camelCase.
    Open

        public function _retrieveCurrentVersions()
        {
            if (!function_exists('curl_init')) {
                // Override the OK Message - Even if this passes we can't be 100% sure they are accurate since we didn't fetch the latest version
                $this->_message_ok = 'You are running a current stable version of PHP!

    CamelCaseMethodName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name methods.

    Example

    class ClassName {
        public function get_name() {
        }
    }

    Source

    The method _execTest is not named in camelCase.
    Open

        public function _execTest()
        {
            // Get versions
            $version = $this->_retrieveCurrentVersions();
    
    

    CamelCaseMethodName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name methods.

    Example

    class ClassName {
        public function get_name() {
        }
    }

    Source

    The method _setMessages is not named in camelCase.
    Open

        public function _setMessages()
        {
            parent::_setMessages();
    
            // HACK: Force to grab current versions - this will fetch the latest version

    CamelCaseMethodName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name methods.

    Example

    class ClassName {
        public function get_name() {
        }
    }

    Source

    The method _retrieveCurrentValue is not named in camelCase.
    Open

        public function _retrieveCurrentValue()
        {
            $this->current_value = PHP_VERSION;
    
            // $this->current_value = '5.4.15';

    CamelCaseMethodName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name methods.

    Example

    class ClassName {
        public function get_name() {
        }
    }

    Source

    There are no issues that match your filters.

    Category
    Status