Skip to content

Use proper methods for getting and setting variables #59

@NanoSector

Description

@NanoSector

Right now we're getting things like $this->arguments without using proper methods like getArguments.

This is, AFAIK, violating the OOP structure and makes it more difficult to fix bugs.

Consider the following (not a real situation):
A security flaw is found in the way commands handle arguments. This is because arguments are passed without any verification.

Without proper methods: fix every command one by one and hope third party commands will follow sooner or later.
With proper methods: modify getArguments and fix all included and third party commands in one go.

It may seem like a lot of work and at first it is, but I think in the end it will pay off with easier maintenance of the codebase.
Things like $this->bot don't really need this, but couldn't really hurt either.

Interesting read: http://php.net/manual/en/language.oop5.overloading.php
Though I'd personally prefer having a method for each variable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions