mambax7/extgallery

View on GitHub
EXTRA/class/textsanitizer/gallery/MytsGallery.php

Summary

Maintainability
A
1 hr
Test Coverage

Method encode has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function encode($textarea_id)
    {
        \xoops_loadLanguage('extention', 'extgallery');

        /*   $code       = "<img src='"
Severity: Minor
Found in EXTRA/class/textsanitizer/gallery/MytsGallery.php - About 1 hr to fix

    The parameter $textarea_id is not named in camelCase.
    Open

        public function encode($textarea_id)
        {
            \xoops_loadLanguage('extention', 'extgallery');
    
            /*   $code       = "<img src='"

    CamelCaseParameterName

    Since: 0.2

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

    Example

    class ClassName {
        public function doSomething($user_name) {
        }
    }

    Source

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

        public function load($ts)

    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

    There must be one blank line after the last USE statement; 7 found;
    Open

    use MyTextSanitizerExtension;

    Line exceeds 120 characters; contains 257 characters
    Open

            $ts->replacements[] = '<a href="' . XOOPS_URL . '/modules/extgallery/hook-photo.php?id=\\5" rel="lightbox[\\2]" title="\\4" alt="\\4" target="_blank"><img src="' . XOOPS_URL . '/modules/extgallery/hook-thumb.php?id=\\5" title="\\4" alt="\\4" ></a>';

    Line exceeds 120 characters; contains 215 characters
    Open

            $ts->replacements[] = '<a href="' . XOOPS_URL . '/modules/extgallery/hook-photo.php?id=\\1" rel="lightbox" target="_blank"><img src="' . XOOPS_URL . '/modules/extgallery/hook-thumb.php?id=\\1" alt="" ></a>';

    Line exceeds 120 characters; contains 141 characters
    Open

                          . "'><span class='fa fa-file-image-o' aria-hidden='true'></span><span style='font-size:75%;'> Gallery</span></button>";

    Line exceeds 120 characters; contains 133 characters
    Open

            $ts->patterns[]     = "/\[gallery group=(['\"]?)([a-zA-Z0-9]*)\\1 title=(['\"]?)([ a-zA-Z0-9]*)\\3]([0-9]*)\[\/gallery\]/sU";

    Line exceeds 120 characters; contains 220 characters
    Open

            $ts->replacements[] = '<a href="' . XOOPS_URL . '/modules/extgallery/hook-photo.php?id=\\3" rel="lightbox[\\2]" target="_blank"><img src="' . XOOPS_URL . '/modules/extgallery/hook-thumb.php?id=\\3" alt="" ></a>';

    Line exceeds 120 characters; contains 252 characters
    Open

            $ts->replacements[] = '<a href="' . XOOPS_URL . '/modules/extgallery/hook-photo.php?id=\\3" rel="lightbox" title="\\2" alt="\\2" target="_blank"><img src="' . XOOPS_URL . '/modules/extgallery/hook-thumb.php?id=\\3" alt="\\2" title="\\2" ></a>';

    Line exceeds 120 characters; contains 257 characters
    Open

            $ts->replacements[] = '<a href="' . XOOPS_URL . '/modules/extgallery/hook-photo.php?id=\\5" rel="lightbox[\\4]" title="\\2" alt="\\2" target="_blank"><img src="' . XOOPS_URL . '/modules/extgallery/hook-thumb.php?id=\\5" title="\\2" alt="\\2" ></a>';

    Line exceeds 120 characters; contains 133 characters
    Open

            $ts->patterns[]     = "/\[gallery title=(['\"]?)([ a-zA-Z0-9]*)\\1 group=(['\"]?)([a-zA-Z0-9]*)\\3]([0-9]*)\[\/gallery\]/sU";

    The variable $textarea_id is not named in camelCase.
    Open

        public function encode($textarea_id)
        {
            \xoops_loadLanguage('extention', 'extgallery');
    
            /*   $code       = "<img src='"

    CamelCaseVariableName

    Since: 0.2

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

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    There are no issues that match your filters.

    Category
    Status