FossabotCommander
interface FossabotCommander (View source)
Main class to invoke a given \Brandon14\FossabotCommander\Contracts\FossabotCommand instance.
Methods
Get \Psr\Http\Client\ClientInterface instance.
Set a new \Psr\Http\Client\ClientInterface instance.
Get \Psr\Http\Message\RequestFactoryInterface instance.
Set a new \Psr\Http\Message\RequestFactoryInterface instance.
Get \Psr\Log\LoggerInterface instance.
Fluent setter for setting a new \Psr\Log\LoggerInterface instance.
Enable logging. Will throw an \Brandon14\FossabotCommander\Contracts\Exceptions\NoValidLoggerProvidedException when enabling this without providing a valid \Psr\Log\LoggerInterface instance.
Disables logging for the \Brandon14\FossabotCommander\Contracts\FossabotCommander instance.
Sets whether to log or not for the \Brandon14\FossabotCommander\Contracts\FossabotCommander instance.
Gets the configured logging setting.
Set whether to include additional context with logging messages.
Gets the configured logging context setting.
Will execute a given \Brandon14\FossabotCommander\Contracts\FossabotCommand instance. If this method throws a \Brandon14\FossabotCommander\Contracts\Exceptions\CannotValidateRequestException, then it was unable to verify that the request came from Fossabot, and should be treated as a critical error.
Gets general class information used for providing additional logging context.
Details
ClientInterface
getHttpClient()
Get \Psr\Http\Client\ClientInterface instance.
FossabotCommander
setHttpClient(ClientInterface $httpClient)
Set a new \Psr\Http\Client\ClientInterface instance.
RequestFactoryInterface
getRequestFactory()
Get \Psr\Http\Message\RequestFactoryInterface instance.
FossabotCommander
setRequestFactory(RequestFactoryInterface $requestFactory)
Set a new \Psr\Http\Message\RequestFactoryInterface instance.
LoggerInterface|null
getLogger()
Get \Psr\Log\LoggerInterface instance.
FossabotCommander
setLog(LoggerInterface|null $logger)
Fluent setter for setting a new \Psr\Log\LoggerInterface instance.
FossabotCommander
enableLogging()
Enable logging. Will throw an \Brandon14\FossabotCommander\Contracts\Exceptions\NoValidLoggerProvidedException when enabling this without providing a valid \Psr\Log\LoggerInterface instance.
FossabotCommander
disableLogging()
Disables logging for the \Brandon14\FossabotCommander\Contracts\FossabotCommander instance.
FossabotCommander
setLogging(bool $logging)
Sets whether to log or not for the \Brandon14\FossabotCommander\Contracts\FossabotCommander instance.
If enabling, and no valid PSR logging is provided, it will throw an exception.
bool
getLogging()
Gets the configured logging setting.
FossabotCommander
setIncludeLogContext(bool $includeLogContext)
Set whether to include additional context with logging messages.
bool
getIncludeLogContext()
Gets the configured logging context setting.
string
runCommand(FossabotCommand|callable $command, string $customApiToken, bool $getContext = true)
Will execute a given \Brandon14\FossabotCommander\Contracts\FossabotCommand instance. If this method throws a \Brandon14\FossabotCommander\Contracts\Exceptions\CannotValidateRequestException, then it was unable to verify that the request came from Fossabot, and should be treated as a critical error.
If this method throws a \Brandon14\FossabotCommander\Contracts\Exceptions\RateLimitException then that means that Fossabot's API is throttling your requests, and you should check the rate limit parameters available in the exception to determine how to handle it.
To get the $customApiToken, you can obtain it from the Fossabot request header 'x-fossabot-customapitoken'.
array
getLoggingContext()
Gets general class information used for providing additional logging context.