qcubed/framework

View on GitHub
assets/php/examples/events_actions/event_delegation.php

Summary

Maintainability
A
0 mins
Test Coverage

Missing class import via use statement (line '11', column '28').
Open

            $this->dtgPersons = new QDataGrid($this, 'dtgPersons');

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 '80', column '23').
Open

                $objControl = new QButton($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 '83', column '32').
Open

                $objControl->AddAction(new QClickEvent(), new QAjaxAction('dtgPersonsButton_Click')); // This will generate a javascript call for every button created.

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

            $this->dtgPersonsDelegated = new QDataGrid($this, 'dtgPersonsDelegated');

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 '36', column '9').
Open

                new QClickEvent(null, 0, 'button[data-id]'),

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 '83', column '51').
Open

                $objControl->AddAction(new QClickEvent(), new QAjaxAction('dtgPersonsButton_Click')); // This will generate a javascript call for every button created.

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 '41', column '9').
Open

                new QAjaxAction('dtgPersonsButton_Click', null, null, '$j(event.target).data("id")')

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 'QApplication' in method 'dtgPersonsButton_Click'.
Open

            QApplication::DisplayAlert("You clicked on a person with ID #{$intPersonId}: {$objPerson->FirstName} {$objPerson->LastName}");

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 'Person' in method 'dtgPersons_Bind'.
Open

            $objControl->DataSource = Person::LoadAll();

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 'Person' in method 'dtgPersonsButton_Click'.
Open

            $objPerson = Person::Load($intPersonId);

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 unused parameters such as '$strControlId'.
Open

        public function dtgPersonsButton_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

        public function dtgPersonsButton_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

The method Form_Create is not named in camelCase.
Open

        protected function Form_Create() {
            // Define the DataGrid
            $this->dtgPersons = new QDataGrid($this, 'dtgPersons');
            $this->dtgPersons->Height = "560px";
            

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

        public function dtgPersonsButton_Click($strFormId, $strControlId, $strParameter) {
            $intPersonId = intval($strParameter);
            
            $objPerson = Person::Load($intPersonId);
            QApplication::DisplayAlert("You clicked on a person with ID #{$intPersonId}: {$objPerson->FirstName} {$objPerson->LastName}");

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

        public function RenderDeleteButton2($objPerson) {
            //create the delete button row, with a special naming scheme for the button ids: "delete_" . id (where id is a person id)
            return '<button data-id="' . $objPerson->Id . '">Edit</button>';
        }

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

        public function RenderDeleteButton($objPerson) {
            $strControlId = 'btn' . $objPerson->Id;
            $objControl = $this->GetControl($strControlId);
            if (!$objControl) {
                $objControl = new QButton($this);

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

        protected function dtgPersons_Bind($objControl) {
            // Use the control passed in to the data binder to know to which to send the data.
            $objControl->DataSource = Person::LoadAll();
        }

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