mirror of
https://github.com/flextype/flextype.git
synced 2025-08-08 06:06:45 +02:00
feat(core): add ability to determine API Request #507
This commit is contained in:
@@ -12,6 +12,8 @@ namespace Flextype\Foundation;
|
||||
use Exception;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Slim\App;
|
||||
use Slim\Http\Environment;
|
||||
use Slim\Http\Uri;
|
||||
|
||||
use function is_null;
|
||||
|
||||
@@ -86,6 +88,16 @@ final class Flextype extends App
|
||||
return self::$instances[$cls];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine API Request
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isApiRequest(): bool
|
||||
{
|
||||
return explode('/', Uri::createFromEnvironment(new Environment($_SERVER))->getPath())[0] === 'api';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current Flextype version
|
||||
*/
|
||||
|
Reference in New Issue
Block a user