Skip to content

Commit e430889

Browse files
authored
Merge pull request #87 from andreaselia/2.0
2.0
2 parents 36566f1 + fae13ad commit e430889

17 files changed

+693
-532
lines changed

.github/workflows/CS.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: CS
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
tests:
8+
runs-on: ubuntu-latest
9+
name: Code Style
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Install Dependencies
13+
run: php /usr/bin/composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist
14+
- name: Verify
15+
run: php vendor/bin/pint --test

composer.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0",
3535
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0",
3636
"illuminate/routing": "^6.0|^7.0|^8.0|^9.0|^10.0",
37-
"phpstan/phpdoc-parser": "^1.24"
37+
"phpstan/phpdoc-parser": "^1.26"
3838
},
3939
"extra": {
4040
"laravel": {
@@ -47,6 +47,7 @@
4747
"prefer-stable": true,
4848
"require-dev": {
4949
"orchestra/testbench": "^8.0",
50-
"phpunit/phpunit": "^10.0"
50+
"phpunit/phpunit": "^10.0",
51+
"laravel/pint": "^1.13"
5152
}
5253
}

config/api-postman.php

+15-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
| Include Doc Comments
9090
|--------------------------------------------------------------------------
9191
|
92-
| Determines whether or not to set the PHP Doc comments to the description
92+
| Determines whether to set the PHP Doc comments to the description
9393
| in postman.
9494
|
9595
*/
@@ -156,6 +156,20 @@
156156

157157
'disk' => 'local',
158158

159+
/*
160+
|--------------------------------------------------------------------------
161+
| Authentication
162+
|--------------------------------------------------------------------------
163+
|
164+
| Specify the authentication to be used for the endpoints.
165+
|
166+
*/
167+
168+
'authentication' => [
169+
'method' => env('POSTMAN_EXPORT_AUTH_METHOD'),
170+
'token' => env('POSTMAN_EXPORT_AUTH_TOKEN'),
171+
],
172+
159173
/*
160174
|--------------------------------------------------------------------------
161175
| Protocol Profile Behavior

phpunit.xml

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3-
<coverage/>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
bootstrap="vendor/autoload.php"
5+
backupGlobals="false"
6+
colors="true"
7+
processIsolation="false"
8+
stopOnFailure="false"
9+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
10+
cacheDirectory=".phpunit.cache"
11+
backupStaticProperties="false"
12+
>
13+
<source>
14+
<include>
15+
<directory suffix=".php">src/</directory>
16+
</include>
17+
</source>
418
<testsuites>
519
<testsuite name="Unit">
620
<directory suffix="Test.php">./tests/Unit</directory>
@@ -12,9 +26,4 @@
1226
<php>
1327
<env name="DB_CONNECTION" value="testing"/>
1428
</php>
15-
<source>
16-
<include>
17-
<directory suffix=".php">src/</directory>
18-
</include>
19-
</source>
2029
</phpunit>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace AndreasElia\PostmanGenerator\Authentication;
4+
5+
use Illuminate\Contracts\Support\Arrayable;
6+
7+
abstract class AuthenticationMethod implements Arrayable
8+
{
9+
public function __construct(protected ?string $token = null)
10+
{
11+
}
12+
13+
public function toArray(): array
14+
{
15+
return [
16+
'key' => 'Authorization',
17+
'value' => sprintf('%s %s', $this->prefix(), $this->token ?? '{{token}}'),
18+
];
19+
}
20+
21+
public function getToken(): string
22+
{
23+
return $this->token;
24+
}
25+
26+
abstract public function prefix(): string;
27+
}

src/Authentication/Basic.php

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace AndreasElia\PostmanGenerator\Authentication;
4+
5+
class Basic extends AuthenticationMethod
6+
{
7+
public function prefix(): string
8+
{
9+
return 'Basic';
10+
}
11+
}

src/Authentication/Bearer.php

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace AndreasElia\PostmanGenerator\Authentication;
4+
5+
class Bearer extends AuthenticationMethod
6+
{
7+
public function prefix(): string
8+
{
9+
return 'Bearer';
10+
}
11+
}

0 commit comments

Comments
 (0)