1
0
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:
Awilum
2020-12-17 10:01:04 +03:00
parent 5f9430bb99
commit f50e78913e

View File

@@ -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
*/