qcubed/framework

View on GitHub
assets/php/examples/image_label/intro.php

Summary

Maintainability
A
1 hr
Test Coverage

Method Form_Create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        protected function Form_Create() {
            // First, we'll scan the QCubed Fonts directory for all the available
            // PFB (Adobe Type 1) font files, and create a listbox of them.
            $this->lstFont = new QListBox($this);
            $objFontDirectory = opendir(__QCUBED_CORE__ . '/fonts');
Severity: Minor
Found in assets/php/examples/image_label/intro.php - About 1 hr to fix

    Missing class import via use statement (line '19', column '54').
    Open

                $this->lstFont->AddAction(new QChangeEvent(), new QAjaxAction('lstFont_Change'));

    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 '19', column '34').
    Open

                $this->lstFont->AddAction(new QChangeEvent(), new QAjaxAction('lstFont_Change'));

    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 '26', column '28').
    Open

                $this->lblMessage = new QImageLabel($this);

    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 '82', column '29').
    Open

                $this->txtMessage1 = new QTextBox($this);

    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 '71', column '37').
    Open

                $this->lblMessage->AddAction(new QClickEvent(), new QAjaxAction('lblMessage_Click'));

    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 '71', column '56').
    Open

                $this->lblMessage->AddAction(new QClickEvent(), new QAjaxAction('lblMessage_Click'));

    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 '86', column '29').
    Open

                $this->txtMessage2 = new QTextBox($this);

    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 '17', column '34').
    Open

                        $this->lstFont->AddItem(new QListItem(substr($strFile, 0, $intPosition), $strFile));

    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 '13', column '25').
    Open

                $this->lstFont = new QListBox($this);

    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 assigning values to variables in if clauses and the like (line '16', column '9').
    Open

            protected function Form_Create() {
                // First, we'll scan the QCubed Fonts directory for all the available
                // PFB (Adobe Type 1) font files, and create a listbox of them.
                $this->lstFont = new QListBox($this);
                $objFontDirectory = opendir(__QCUBED_CORE__ . '/fonts');

    IfStatementAssignment

    Since: 2.7.0

    Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($foo = 'bar') { // possible typo
                // ...
            }
            if ($baz = 0) { // always false
                // ...
            }
        }
    }

    Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

    Avoid unused parameters such as '$strControlId'.
    Open

            protected function lblMessage_Click($strFormId, $strControlId, $strParameter) {

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

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

    Avoid unused parameters such as '$strParameter'.
    Open

            protected function lblMessage_Click($strFormId, $strControlId, $strParameter) {

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

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

    Avoid unused parameters such as '$strFormId'.
    Open

            protected function lstFont_Change($strFormId, $strControlId, $strParameter) {

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

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

    Avoid unused parameters such as '$strFormId'.
    Open

            protected function lblMessage_Click($strFormId, $strControlId, $strParameter) {

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

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

    Avoid unused parameters such as '$strParameter'.
    Open

            protected function lstFont_Change($strFormId, $strControlId, $strParameter) {

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

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

    Avoid unused parameters such as '$strControlId'.
    Open

            protected function lstFont_Change($strFormId, $strControlId, $strParameter) {

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

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

    The method lstFont_Change is not named in camelCase.
    Open

            protected function lstFont_Change($strFormId, $strControlId, $strParameter) {
                // Set the lblMessage's font to the new font file
                $this->lblMessage->FontNames = $this->lstFont->SelectedValue;
            }

    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 Form_Create is not named in camelCase.
    Open

            protected function Form_Create() {
                // First, we'll scan the QCubed Fonts directory for all the available
                // PFB (Adobe Type 1) font files, and create a listbox of them.
                $this->lstFont = new QListBox($this);
                $objFontDirectory = opendir(__QCUBED_CORE__ . '/fonts');

    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 lblMessage_Click is not named in camelCase.
    Open

            protected function lblMessage_Click($strFormId, $strControlId, $strParameter) {
                // We will toggle between the two textbox messages so that we can show
                // off the dynamic rendering capability of the QImageLabel
                if ($this->lblMessage->Text == $this->txtMessage1->Text)
                    $this->lblMessage->Text = $this->txtMessage2->Text;

    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