Last active
July 3, 2020 12:00
-
-
Save samadfcibd/d3511ebe7a7f65ebb70d02570e51a7af to your computer and use it in GitHub Desktop.
This file contains 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 GoogleAuthenticationService | |
{ | |
public function authenticate($email) | |
{ | |
return 'true'; | |
} | |
} | |
class userLogin | |
{ | |
public function login($email) | |
{ | |
// DIP violates here | |
$google_authentication = new GoogleAuthenticationService(); | |
$auth_result = $google_authentication->authenticate($email); | |
if ($auth_result) { | |
return true; | |
} | |
} | |
} | |
$login = new userLogin(); | |
$login->login('samadocpl@gmail.com'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment