Skip to content

Commit

Permalink
ran pint
Browse files Browse the repository at this point in the history
  • Loading branch information
dcblogdev committed Mar 11, 2024
1 parent 6ae949b commit 5847401
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/AdminResources/CalendarEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function find(string $calendarId, string $eventId): MsGraphAdmin
/**
* @throws Exception
*/
public function store(string $calendarId, array$data): MsGraphAdmin
public function store(string $calendarId, array $data): MsGraphAdmin
{
if ($this->userId === '') {
throw new Exception('userId is required.');
Expand Down
4 changes: 2 additions & 2 deletions src/AdminResources/Emails.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function userid(string $userId): static
return $this;
}

public function top(string$top): static
public function top(string $top): static
{
$this->top = $top;

Expand Down Expand Up @@ -223,7 +223,7 @@ public function reply(): MsGraphAdmin
throw new Exception('userId is required.');
}

if (strlen($this->id ) === 0) {
if (strlen($this->id) === 0) {
throw new Exception('email id is required.');
}

Expand Down
6 changes: 3 additions & 3 deletions src/MsGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Http\Client\RequestException;
use Illuminate\Http\RedirectResponse;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Http;
Expand Down Expand Up @@ -58,6 +57,7 @@ public function tasks(): Tasks
}

protected static string $baseUrl = 'https://graph.microsoft.com/v1.0/';

protected static string $userModel = '';

/**
Expand Down Expand Up @@ -190,7 +190,7 @@ public function getAccessToken(string $id = null, bool $redirectWhenNotConnected
return $token->access_token;
}

public function getTokenData(string $id = null): MsGraphToken|null
public function getTokenData(string $id = null): ?MsGraphToken
{
$id = $this->getUserId($id);

Expand Down Expand Up @@ -322,7 +322,7 @@ protected function isJson(string $string): bool
return is_array(json_decode($string, true)) && (json_last_error() == JSON_ERROR_NONE);
}

protected function getUserId(string $id = null): string|null
protected function getUserId(string $id = null): ?string
{
if ($id === null) {
$id = auth()->id();
Expand Down
2 changes: 1 addition & 1 deletion src/MsGraphAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function getAccessToken(bool $returnNullNoAccessToken = false, bool $redi
}
}

public function getTokenData(): MsGraphToken|null
public function getTokenData(): ?MsGraphToken
{
return MsGraphToken::where('user_id', null)->first();
}
Expand Down
1 change: 0 additions & 1 deletion src/MsGraphServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Dcblogdev\MsGraph\Console\Commands\MsGraphAdminKeepAliveCommand;
use Dcblogdev\MsGraph\Console\Commands\MsGraphKeepAliveCommand;
use Dcblogdev\MsGraph\Facades\MsGraph as MsGraphFacade;
use Dcblogdev\MsGraph\Services\ProviderService;
use GuzzleHttp\Client;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Routing\Router;
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ protected function createUploadSession(string $name, string $path = '', string $

protected function forceStartingSlash(string $string): string
{
if (!str_starts_with($string, '/')) {
if (! str_starts_with($string, '/')) {
$string = "/$string";
}

Expand Down
8 changes: 4 additions & 4 deletions tests/MsGraphTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@
$this->mock(GenericProvider::class, function (MockInterface $mock) {
$mockAccessToken = new AccessToken(['access_token' => 'mock_token']);
$mock->shouldReceive('getAccessToken')
->with('authorization_code', ['code' => 'sample'])
->once()
->andReturn($mockAccessToken);
->with('authorization_code', ['code' => 'sample'])
->once()
->andReturn($mockAccessToken);
});

// Simulate a GET request with the 'code' query parameter
Expand Down Expand Up @@ -153,7 +153,7 @@
expect($response)->toBeNull();
});

test('can store token data', function() {
test('can store token data', function () {

$id = 1;
$email = '[email protected]';
Expand Down

0 comments on commit 5847401

Please sign in to comment.