forked from admin/services_core
Ubah dari Swagger ke Dedoc lalu buat API Ticket dan TicketType
This commit is contained in:
+10
File diff suppressed because one or more lines are too long
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Dedoc\Scramble\Infer\Scope\Index;
|
||||
use Dedoc\Scramble\Infer\Services\FileParser;
|
||||
use PhpParser\ParserFactory;
|
||||
|
||||
include 'vendor/autoload.php';
|
||||
|
||||
$classes = [
|
||||
Exception::class,
|
||||
RuntimeException::class,
|
||||
\Symfony\Component\HttpKernel\Exception\HttpException::class,
|
||||
];
|
||||
|
||||
app()->singleton(FileParser::class, function () {
|
||||
return new FileParser(
|
||||
(new ParserFactory)->createForHostVersion()
|
||||
);
|
||||
});
|
||||
app()->singleton(Index::class);
|
||||
|
||||
$classesDefinitions = [];
|
||||
foreach ($classes as $className) {
|
||||
$classesDefinitions[$className] = generateClassDefinitionInitialization($className);
|
||||
}
|
||||
|
||||
function generateClassDefinitionInitialization(string $name)
|
||||
{
|
||||
$classAnalyzer = app(\Dedoc\Scramble\Infer\Analyzer\ClassAnalyzer::class);
|
||||
|
||||
$classDefinition = $classAnalyzer->analyze($name);
|
||||
foreach ($classDefinition->methods as $methodName => $method) {
|
||||
$classDefinition->getMethodDefinition($methodName);
|
||||
}
|
||||
|
||||
return serialize($classAnalyzer->analyze($name));
|
||||
}
|
||||
|
||||
$def = var_export($classesDefinitions, true);
|
||||
file_put_contents(__DIR__.'/../classMap.php', <<<EOL
|
||||
<?php
|
||||
/*
|
||||
* Do not change! This file is generated via scripts/generate.php.
|
||||
*/
|
||||
return {$def};
|
||||
EOL);
|
||||
Reference in New Issue
Block a user