From 4bef8e2f9b7ab71700e6f60abde8623dd52ed8c4 Mon Sep 17 00:00:00 2001 From: Guus De Graeve Date: Tue, 23 Feb 2016 22:40:24 +0100 Subject: [PATCH] replace get_class with instanceof for $this->app When using get_class, in Lumen the $this->app could only be an instance of the \Laravel\Lumen\Application and not an instance of a class extending from \Laravel\Lumen\Application. When using the instanceof check people can use a custom application class extending from the main Lumen Application class. To make this work i had to remove the use statements at the top and replace the references in getProvider with the full paths. --- src/Intervention/Image/ImageServiceProvider.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Intervention/Image/ImageServiceProvider.php b/src/Intervention/Image/ImageServiceProvider.php index 47eff4ea..234e06cf 100644 --- a/src/Intervention/Image/ImageServiceProvider.php +++ b/src/Intervention/Image/ImageServiceProvider.php @@ -2,7 +2,6 @@ namespace Intervention\Image; -use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; class ImageServiceProvider extends ServiceProvider @@ -61,9 +60,9 @@ class ImageServiceProvider extends ServiceProvider */ private function getProvider() { - if (get_class($this->app) == 'Laravel\Lumen\Application') { + if ($this->app instanceof \Laravel\Lumen\Application) { $provider = '\Intervention\Image\ImageServiceProviderLumen'; - } elseif (version_compare(Application::VERSION, '5.0', '<')) { + } elseif (version_compare(\Illuminate\Foundation\Application::VERSION, '5.0', '<')) { $provider = '\Intervention\Image\ImageServiceProviderLaravel4'; } else { $provider = '\Intervention\Image\ImageServiceProviderLaravel5';