Skip to content

Commit

Permalink
stash schwager
Browse files Browse the repository at this point in the history
  • Loading branch information
rodber committed Jan 21, 2024
1 parent 1e29fdf commit e84dbaa
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 33 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"dg/bypass-finals": "^1.4",
"phpstan/phpstan": "^1.9",
"phpunit/phpunit": "^9.5",
"chevere/schwager": "^0.2.x-dev",
"symplify/easy-coding-standard": "^11.1"
},
"autoload": {
Expand Down
64 changes: 32 additions & 32 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,35 +297,35 @@ function getPrivateKey(
return $privateKey;
}

function schwager(
string $version,
RouterInterface $router,
FileInterface $file,
): void {
$document = new DocumentSchema(
api: 'xr',
name: 'xrDebug API',
version: $version
);
$server = new ServerSchema(
url: '',
description: 'xrDebug',
);
$spec = new Spec($router, $document, $server);
$array = arrayFilterBoth($spec->toArray(), function ($v, $k) {
return match (true) {
$v === null => false,
$v === [] => false,
$v === '' => false,
$k === 'required' && $v === true => false,
$k === 'regex' && $v === '^.*$' => false,
$k === 'body' && $v === [
'type' => 'array#map',
] => false,
default => true,
};
});
$json = json_encode($array, JSON_PRETTY_PRINT);
$file->createIfNotExists();
$file->put($json);
}
// function schwager(
// string $version,
// RouterInterface $router,
// FileInterface $file,
// ): void {
// $document = new DocumentSchema(
// api: 'xr',
// name: 'xrDebug API',
// version: $version
// );
// $server = new ServerSchema(
// url: '',
// description: 'xrDebug',
// );
// $spec = new Spec($router, $document, $server);
// $array = arrayFilterBoth($spec->toArray(), function ($v, $k) {
// return match (true) {
// $v === null => false,
// $v === [] => false,
// $v === '' => false,
// $k === 'required' && $v === true => false,
// $k === 'regex' && $v === '^.*$' => false,
// $k === 'body' && $v === [
// 'type' => 'array#map',
// ] => false,
// default => true,
// };
// });
// $json = json_encode($array, JSON_PRETTY_PRINT);
// $file->createIfNotExists();
// $file->put($json);
// }

0 comments on commit e84dbaa

Please sign in to comment.