Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to update the app id/secret #92

Merged
merged 6 commits into from
Nov 12, 2015
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions src/LaravelFacebookSdk/LaravelFacebookSdk.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php namespace SammyK\LaravelFacebookSdk;

use Facebook\Facebook;
use Illuminate\Config\Repository as Config;
use Illuminate\Routing\UrlGenerator as Url;
use Facebook\Facebook;

class LaravelFacebookSdk extends Facebook
{
Expand All @@ -24,11 +24,22 @@ class LaravelFacebookSdk extends Facebook
public function __construct(Config $config_handler, Url $url, array $config)
{
$this->config_handler = $config_handler;
$this->url = $url;
$this->url = $url;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No extra spaces between the variable and the = here to align it. It makes diffs harder to read.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops

$this->default_config = $config;

parent::__construct($config);
}

/**
* @param array $config
*/
public function newInstance(array $config)
{
$new_config = array_merge($this->default_config, $config);

return new static($this->config_handler, $this->url, $config);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be passing in $new_config as the 3rd arg

}

/**
* Generate an OAuth 2.0 authorization URL for authentication.
*
Expand All @@ -39,7 +50,7 @@ public function __construct(Config $config_handler, Url $url, array $config)
*/
public function getLoginUrl(array $scope = [], $callback_url = '')
{
$scope = $this->getScope($scope);
$scope = $this->getScope($scope);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No extra spaces here.

$callback_url = $this->getCallbackUrl($callback_url);

return $this->getRedirectLoginHelper()->getLoginUrl($callback_url, $scope);
Expand All @@ -55,7 +66,7 @@ public function getLoginUrl(array $scope = [], $callback_url = '')
*/
public function getReRequestUrl(array $scope, $callback_url = '')
{
$scope = $this->getScope($scope);
$scope = $this->getScope($scope);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

$callback_url = $this->getCallbackUrl($callback_url);

return $this->getRedirectLoginHelper()->getReRequestUrl($callback_url, $scope);
Expand All @@ -71,7 +82,7 @@ public function getReRequestUrl(array $scope, $callback_url = '')
*/
public function getReAuthenticationUrl(array $scope = [], $callback_url = '')
{
$scope = $this->getScope($scope);
$scope = $this->getScope($scope);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here. :)

$callback_url = $this->getCallbackUrl($callback_url);

return $this->getRedirectLoginHelper()->getReAuthenticationUrl($callback_url, $scope);
Expand Down