panique / php-login-minimal

An extremely minimal login / register script in pure PHP.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong OOP

nacholibre opened this issue · comments

Hello,

I was looking for simple register/login class already written and I stumbled on your repo, but what I found is wrong OOP, here is why:

  • your classes are named poorly, you can't name a class Login, login is an action, login should be method, you should call the class 'User'. The exact same thing implies for the 'Registration' class
  • checking for $_POST or $_GET in the class constructor is not good, why do you call registerNewUser method in the constructor of 'Registration' class, this should be called from the php file where the POST is sent
  • class with one method is bad, not always, but in your case is
  • registerNewUser method is very long, why not split it in other methods and make those methods easy to understand and clean, class method should be smaller than one screen of code

hope I helped someone

commented

Hey, have you read the readme and got idea what exactly this project was, and why it was written, and when ? It's just the most simple example of a user auth solution, and not a real OOP framework or similar.

If you "want" good OOP then please write it and add it to the project, feel free to commit it anytime! Thanks!