Created
June 9, 2014 14:16
-
-
Save Bolinha1/6fcdea130b94add57e83 to your computer and use it in GitHub Desktop.
Classe que realiza login para diversos tipos de usuário refatorada.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Login; | |
| use User; | |
| abstract class Login | |
| { | |
| abstract public function validate(User $user); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class LoginManager extends Login | |
| { | |
| public function validate(User $user) | |
| { | |
| printf("yeah, your user is manager..."); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class LoginSeller extends Login | |
| { | |
| public function validate(User $user) | |
| { | |
| printf("yeah, your user is seller..."); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use User; | |
| use LoginManager; | |
| use LoginSeller; | |
| $loginManager = new LoginManager(); | |
| $loginManager->validate(new User('manager')); | |
| $loginSeller = new LoginSeller(); | |
| $loginSeller->validate(new User('seller')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment