It makes sense to me. Part of why my library is like this is because the Fire Eagle class and the OAuth code is like this. One issue with build isAuthenticated into library is they then have to be aware of however you are storing the access tokens/etc. I would probably be easier for you to extend the class and add your own isAuthenticated function.
Abraham On Wed, Jun 3, 2009 at 16:57, Tim <[email protected]> wrote: > > Hello, > > (note: this question might actually be more a general programming > question rather than specific to Twitter) > I have been looking at a few PHP libraries to use OAuth with Twitter > (thanks to Abraham and Jason amongst others) and noticed that most (if > not all) of them have a constructor more or less like that: > function __construct($consumer_key, $consumer_secret, $oauth_token = > NULL, $oauth_token_secret = NULL) > called with 2 or 4 arguments depending on where in the OAuth process > we are. (access token already known or not) > > That usually means that the status of the OAuth process is to be > managed in the controllers when creating the object. > If you take the example from Abraham's code: > > http://github.com/abraham/twitteroauth/blob/6b28e9e689d44a569576f726777e9986fa67729c/example/index.php > there's a lot of session variables management (granted, this code is > provided as an example and advertised as "not for production"...) > > Basically, I feel that I'd rather do something like: > > $twitter = new TwitterOAuth(); > $twitter->getPublicTimeline(); > if ($twitter->isAuthenticated()) { $twitter->getFriendsTimeline();} > etc. > > with the logic of if the access token is known being handled by the > class itself. > > Since all the libraries I have seen didn't go this way (and were > written by people who most probably know what they're doing a lot more > than I do), I am wondering if I make any sense. > > Thanks for your help, > > Tim > -- Abraham Williams | http://the.hackerconundrum.com Hacker | http://abrah.am | http://twitter.com/abraham Project | http://fireeagle.labs.poseurtech.com This email is: [ ] blogable [x] ask first [ ] private. Sent from Madison, Wisconsin, United States
