Files
kulakpos_web/vendor/knuckleswtf/scribe/src/Extracting/Strategies/Strategy.php
eko54r 1228c52538
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m36s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 42s
Build, Push and Deploy / deploy-production (push) Has been skipped
update after stop build
2026-04-18 16:10:57 +07:00

48 lines
1.7 KiB
PHP

<?php
namespace Knuckles\Scribe\Extracting\Strategies;
use Knuckles\Camel\Extraction\ExtractedEndpointData;
use Knuckles\Scribe\Tools\DocumentationConfig;
abstract class Strategy
{
public ?ExtractedEndpointData $endpointData;
public function __construct(protected DocumentationConfig $config) {}
/**
* @param array $settings settings to be applied to this strategy
*/
abstract public function __invoke(ExtractedEndpointData $endpointData, array $settings = []): ?array;
/**
* Returns an instance of the documentation config.
*/
public function getConfig(): DocumentationConfig
{
return $this->config;
}
/**
* Helper method that returns a tuple of [$strategyName, $settingsArray].
* Main real advantage is that it validates the mutual exclusion of $only and $except.
*
* @param array $only The routes which this strategy should be applied to. Can not be specified with $except.
* Specify route names ("users.index", "users.*"), or method and path ("GET *", "POST /safe/*").
* @param array $except The routes which this strategy should be applied to. Can not be specified with $only.
* Specify route names ("users.index", "users.*"), or method and path ("GET *", "POST /safe/*").
* @return array{string,array} tuple of strategy class FQN and specified settings
*/
public static function wrapWithSettings(
array $only = [],
array $except = [],
array $otherSettings = [],
): array {
return [
static::class,
['only' => $only, 'except' => $except, ...$otherSettings],
];
}
}