Created
April 28, 2015 08:51
-
-
Save simonmilz/90e0d5851e3f276fd697 to your computer and use it in GitHub Desktop.
tt
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 User { | |
protected $email; | |
protected $password; | |
public function is($role = 'user') {} | |
public function login($email, $pass) {} | |
public function isLoggedin() {} | |
getEmail | |
getPass | |
} | |
class Auth { | |
protected $_provider = array(); | |
public function addAuthProvider(AuthProvider $provider) {} | |
public function authenticate(User $user) {} | |
} | |
interface AuthProvider { | |
public function authenticate(User $user); | |
} | |
class AuthProviderLdap implements AuthProvider {} | |
class AuthProviderDb implements AuthProvider {} | |
class AuthProviderOauth implements AuthProvider {} | |
// ************************** // | |
$user = new User($email, $password); | |
$auth = new Auth(); | |
$auth | |
->addAuthProvider($db) | |
->addAuthProvider($ldap) | |
->addAuthProvider($oauth) | |
; | |
$AuthController->authenticate($user); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment