1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-22 05:22:50 +02:00

Add DriverInterface::version() and make method non-static

This commit is contained in:
Oliver Vogel
2025-06-20 16:53:24 +02:00
parent a1e382ec49
commit 2fb891da36
3 changed files with 9 additions and 2 deletions

View File

@@ -156,7 +156,7 @@ class Driver extends AbstractDriver
/**
* Return version of GD library
*/
public static function version(): string
public function version(): string
{
return gd_info()['GD Version'];
}

View File

@@ -160,7 +160,7 @@ class Driver extends AbstractDriver
*
* @throws DriverException
*/
public static function version(): string
public function version(): string
{
$pattern = '/^ImageMagick (?P<version>(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)' .
'(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?' .

View File

@@ -89,4 +89,11 @@ interface DriverInterface
* underlying PHP extension was built with support for the format.
*/
public function supports(string|Format|FileExtension|MediaType $identifier): bool;
/**
* Return the version number of the image driver currently in use.
*
* @throws DriverException
*/
public function version(): string;
}