Skip to content
This repository has been archived by the owner on Nov 18, 2018. It is now read-only.

Commit

Permalink
Merge pull request #4 from mcrumm/bug/closure
Browse files Browse the repository at this point in the history
Fixed invalid use of $this within match closures.
  • Loading branch information
FlorinPopaCodes committed Jun 10, 2013
2 parents fc21653 + 92373af commit ee0b8de
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/SilexOpauth/OpauthExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,25 @@ public function register(Application $app) {
'callback_url' => $app['opauth']['callback'], // Handy shortcut.
'callback_transport' => 'post' // Won't work with silex session
), $app['opauth']['config']
);

$app->match($this->serviceConfig['callback'], function() { return $this->loginCallback(); });

$app->match($this->serviceConfig['login'] . '/{strategy}', function() { return $this->loginAction(); });
$app->match($this->serviceConfig['login'] . '/{strategy}/{return}', function() { return $this->loginAction(); });
);

}
$that = $this;
$app->match($this->serviceConfig['callback'], function () use ($that) {
return $that->loginCallback();
});

$config = $this->serviceConfig['config'];
$init = function () use ($config) {
new Opauth($config);
return '';
};

$app->match($this->serviceConfig['login'] . '/{strategy}', $init);
$app->match($this->serviceConfig['login'] . '/{strategy}/{return}', $init);

protected function loginAction() {
new Opauth($this->serviceConfig['config']);
return '';
}
protected function loginCallback() {

public function loginCallback() {
$Opauth = new Opauth($this->serviceConfig['config'], false);

$response = unserialize(base64_decode($_POST['opauth']));
Expand Down

0 comments on commit ee0b8de

Please sign in to comment.