Skip to content

Commit e676864

Browse files
authored
Final
1 parent 036416d commit e676864

10 files changed

+39
-63
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@ This is the contents of the published config file:
5353

5454
return [
5555
'auth' => [
56-
'client_id' => env('MICROSOFT_PLANNER_CLIENT_ID'),
57-
'client_secret' => env('MICROSOFT_PLANNER_CLIENT_SECRET'),
58-
'tenant_id' => env('MICROSOFT_PLANNER_TENANT_ID'),
59-
'redirect_uri' => env('MICROSOFT_PLANNER_REDIRECT_URI'),
56+
'client_id' => env('LARAVEL_MICROSOFT_PLANNER_CLIENT_ID'),
57+
'client_secret' => env('LARAVEL_MICROSOFT_PLANNER_CLIENT_SECRET'),
58+
'tenant_id' => env('LARAVEL_MICROSOFT_PLANNER_TENANT_ID'),
6059
]
6160
];
6261
```

composer.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,7 @@
7676
"laravel": {
7777
"providers": [
7878
"CodebarAg\\LaravelMicrosoftPlanner\\LaravelMicrosoftPlannerServiceProvider"
79-
],
80-
"aliases": {
81-
"LaravelMicrosoftPlanner": "CodebarAg\\LaravelMicrosoftPlanner\\Facades\\LaravelMicrosoftPlanner"
82-
}
79+
]
8380
}
8481
},
8582
"minimum-stability": "dev",

config/laravel-microsoft-planner.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
// config for CodebarAg/LaravelMicrosoftPlanner
4+
5+
return [
6+
'auth' => [
7+
'client_id' => env('LARAVEL_MICROSOFT_PLANNER_CLIENT_ID'),
8+
'client_secret' => env('LARAVEL_MICROSOFT_PLANNER_CLIENT_SECRET'),
9+
'tenant_id' => env('LARAVEL_MICROSOFT_PLANNER_TENANT_ID'),
10+
],
11+
];

config/microsoft-planner.php

Lines changed: 0 additions & 12 deletions
This file was deleted.

phpstan.neon.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ parameters:
1010
checkOctaneCompatibility: true
1111
checkModelProperties: true
1212
checkMissingIterableValueType: false
13+
ignoreErrors:
14+
# new static() is a best practice in Drupal, so we cannot fix that.
15+
- "#^Unsafe usage of new static#"
1316

src/Facades/LaravelMicrosoftPlanner.php

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/Http/Connectors/MicrosoftPlannerConnector.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,29 @@ public function resolveBaseUrl(): string
1717

1818
protected function defaultOauthConfig(): OAuthConfig
1919
{
20+
$this->setAuth();
21+
2022
return OAuthConfig::make()
21-
->setClientId(config('microsoft-planner.auth.client_id'))
22-
->setClientSecret(config('microsoft-planner.auth.client_secret'))
23-
->setTokenEndpoint('https://login.windows.net/'.config('microsoft-planner.auth.tenant_id').'/oauth2/v2.0/token')
23+
->setClientId(config('laravel-microsoft-planner.auth.client_id'))
24+
->setClientSecret(config('laravel-microsoft-planner.auth.client_secret'))
25+
->setTokenEndpoint('https://login.windows.net/'.config('laravel-microsoft-planner.auth.tenant_id').'/oauth2/v2.0/token')
2426
->setDefaultScopes([
2527
'https://graph.microsoft.com/.default',
2628
]);
2729
}
30+
31+
public function setAuth(): void
32+
{
33+
if (! config('laravel-microsoft-planner.auth.client_id')) {
34+
throw new \Exception('No client_id provided.', 500);
35+
}
36+
37+
if (! config('laravel-microsoft-planner.auth.client_secret')) {
38+
throw new \Exception('No client_secret provided.', 500);
39+
}
40+
41+
if (! config('laravel-microsoft-planner.auth.tenant_id')) {
42+
throw new \Exception('No tenant_id provided.', 500);
43+
}
44+
}
2845
}

src/LaravelMicrosoftPlanner.php

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/LaravelMicrosoftPlannerServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ public function configurePackage(Package $package): void
1616
*/
1717
$package
1818
->name('laravel-microsoft-planner')
19-
->hasConfigFile();
19+
->hasConfigFile('laravel-microsoft-planner');
2020
}
2121
}

tests/Pest.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,3 @@
2727
expect()->extend('toBeOne', function () {
2828
return $this->toBe(1);
2929
});
30-
31-
/*
32-
|--------------------------------------------------------------------------
33-
| Functions
34-
|--------------------------------------------------------------------------
35-
|
36-
| While Pest is very powerful out-of-the-box, you may have some testing code specific to your
37-
| project that you don't want to repeat in every file. Here you can also expose helpers as
38-
| global functions to help you to reduce the number of lines of code in your test files.
39-
|
40-
*/
41-
42-
function something()
43-
{
44-
// ..
45-
}

0 commit comments

Comments
 (0)