You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had the problem that I had to check in a service if the function is called via CLI or web.
Depending on that, I had to make different calculations. That's where my idea comes from, that you could put a function isCLI() or isWeb() into the kernel.
Example
class MyService {
publicfunction__constructor(
privatereadonlyKernelInterface$kernel
){}
publicfunctionmyFunction(): void {
if(!$this->kernel->isCLI())
{
return;
}
// Do things in CLI without Request()
}
}