Auth_OpenID_Consumer::__construct PHP 메소드

__construct() 공개 메소드

You should create a new instance of the Consumer object with every HTTP request that handles OpenID transactions.
public __construct ( Auth_OpenID_OpenIDStore $store, mixed $session = null, str $consumer_cls = null )
$store Auth_OpenID_OpenIDStore This must be an object that implements the interface in {@link Auth_OpenID_OpenIDStore}. Several concrete implementations are provided, to cover most common use cases. For stores backed by MySQL, PostgreSQL, or SQLite, see the {@link Auth_OpenID_SQLStore} class and its sublcasses. For a filesystem-backed store, see the {@link Auth_OpenID_FileStore} module. As a last resort, if it isn't possible for the server to store state at all, an instance of {@link Auth_OpenID_DumbStore} can be used.
$session mixed An object which implements the interface of the {@link Auth_Yadis_PHPSession} class. Particularly, this object is expected to have these methods: get($key), set($key), $value), and del($key). This defaults to a session object which wraps PHP's native session machinery. You should only need to pass something here if you have your own sessioning implementation.
$consumer_cls str The name of the class to instantiate when creating the internal consumer object. This is used for testing.
    function __construct($store, $session = null, $consumer_cls = null)
    {
        if ($session === null) {
            $session = new Auth_Yadis_PHPSession();
        }
        $this->session = $session;
        if ($consumer_cls !== null) {
            $this->consumer = new $consumer_cls($store);
        } else {
            $this->consumer = new Auth_OpenID_GenericConsumer($store);
        }
        $this->_token_key = $this->session_key_prefix . $this->_token_suffix;
    }