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

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
lbeauvisage authored and actions-user committed Mar 19, 2021
1 parent 9c9f65b commit 071b7d4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
5 changes: 1 addition & 4 deletions src/Http/Controllers/InstagramLoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,15 @@ public function index(InstagramApi $instagram)
$instagramMedias = [];

if (config('statamic.instagram.appId') && config('statamic.instagram.appSecret')) {

try {
// dd($instagram);
$userProfile = $instagram->getUserProfile();
if (!$userProfile) {
if (! $userProfile) {
$status = InstagramApi::STATUS_NOT_CONNECTED;
} else {
$status = InstagramApi::STATUS_CONNECTED;
$instagramMedias = $instagram->getUserMedia(5);
}

} catch (InstagramBasicDisplayException | InstagramException | \Exception $exception) {
$error = $exception->getMessage();
$status = InstagramApi::STATUS_HAS_ERROR;
Expand All @@ -56,7 +54,6 @@ public function index(InstagramApi $instagram)
]);
}


/**
* @param InstagramApi $instagram
* @param Request $request
Expand Down
7 changes: 2 additions & 5 deletions src/Http/Controllers/InstagramLogoutController.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
<?php


namespace NineteenSquared\Instagram\Http\Controllers;


use Illuminate\Http\Request;
use NineteenSquared\Instagram\InstagramApi;
use Statamic\Http\Controllers\CP\CpController;

class InstagramLogoutController extends CpController
{

public function __invoke(InstagramApi $instagram, Request $request) {
public function __invoke(InstagramApi $instagram, Request $request)
{
$this->authorize('setup Instagram');

$instagram->logout();

return redirect(route('statamic.cp.nineteen-ig.index'));
}

}
5 changes: 2 additions & 3 deletions src/InstagramApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

class InstagramApi
{

const STATUS_NOT_CONFIGURED = 'NOT_CONFIGURED';
const STATUS_NOT_CONNECTED = 'NOT_CONNECTED';
const STATUS_HAS_ERROR = 'HAS_ERROR';
Expand Down Expand Up @@ -87,11 +86,11 @@ public function refreshToken() : void
*/
public function getUserProfile() : ? object
{
if (!$this->instagram_basic_display || !$this->instagram_basic_display->getAccessToken()) {
if (! $this->instagram_basic_display || ! $this->instagram_basic_display->getAccessToken()) {
return null;
}

$userProfile = $this->instagram_basic_display->getUserProfile();
$userProfile = $this->instagram_basic_display->getUserProfile();

if (isset($userProfile->error)) {
throw new InstagramException($userProfile->error->message);
Expand Down
3 changes: 0 additions & 3 deletions src/InstagramException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<?php


namespace NineteenSquared\Instagram;


class InstagramException extends \Exception
{

}

0 comments on commit 071b7d4

Please sign in to comment.