1
0
mirror of https://github.com/Intervention/image.git synced 2025-09-02 02:12:37 +02:00

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.
This commit is contained in:
Guus De Graeve
2016-02-23 22:40:24 +01:00
parent 86dfe2f2a9
commit 4bef8e2f9b

View File

@@ -2,7 +2,6 @@
namespace Intervention\Image; namespace Intervention\Image;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
class ImageServiceProvider extends ServiceProvider class ImageServiceProvider extends ServiceProvider
@@ -61,9 +60,9 @@ class ImageServiceProvider extends ServiceProvider
*/ */
private function getProvider() private function getProvider()
{ {
if (get_class($this->app) == 'Laravel\Lumen\Application') { if ($this->app instanceof \Laravel\Lumen\Application) {
$provider = '\Intervention\Image\ImageServiceProviderLumen'; $provider = '\Intervention\Image\ImageServiceProviderLumen';
} elseif (version_compare(Application::VERSION, '5.0', '<')) { } elseif (version_compare(\Illuminate\Foundation\Application::VERSION, '5.0', '<')) {
$provider = '\Intervention\Image\ImageServiceProviderLaravel4'; $provider = '\Intervention\Image\ImageServiceProviderLaravel4';
} else { } else {
$provider = '\Intervention\Image\ImageServiceProviderLaravel5'; $provider = '\Intervention\Image\ImageServiceProviderLaravel5';