1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-23 05:52:47 +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 * Return version of GD library
*/ */
public static function version(): string public function version(): string
{ {
return gd_info()['GD Version']; return gd_info()['GD Version'];
} }

View File

@@ -160,7 +160,7 @@ class Driver extends AbstractDriver
* *
* @throws DriverException * @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*)' . $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-]*))*))?' . '(?:-((?: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. * underlying PHP extension was built with support for the format.
*/ */
public function supports(string|Format|FileExtension|MediaType $identifier): bool; 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;
} }