İlk temizlik tamamlandı bir önceki projeden
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Docs\Strategies;
|
||||
|
||||
use Knuckles\Scribe\Extracting\Strategies\Strategy;
|
||||
use Knuckles\Camel\Extraction\ExtractedEndpointData;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* Custom Scribe Strategy to add admin-ajax endpoints to documentation.
|
||||
*
|
||||
* This strategy scans the admin-ajax blade directory and adds
|
||||
* each endpoint to the API documentation automatically.
|
||||
*/
|
||||
class AddEndpointsStrategy extends Strategy
|
||||
{
|
||||
/**
|
||||
* The stage this strategy belongs to.
|
||||
*/
|
||||
public string $stage = 'responses';
|
||||
|
||||
/**
|
||||
* Trait this strategy applies to.
|
||||
*/
|
||||
public static function routableIf(ExtractedEndpointData $endpoint): bool
|
||||
{
|
||||
// Only apply to the dynamic endpoint route
|
||||
return Str::contains($endpoint->route->uri, 'endpoints/{endpoint}');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ExtractedEndpointData $endpointData
|
||||
* @param array $routeRules
|
||||
* @return array|null
|
||||
*/
|
||||
public function __invoke(ExtractedEndpointData $endpointData, array $routeRules = []): ?array
|
||||
{
|
||||
// This strategy doesn't modify responses directly
|
||||
// The actual endpoint enumeration happens via the Artisan command
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user