Skip to content

Commit

Permalink
Test for the new getAdapter() method on CachedAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
weotch committed May 12, 2015
1 parent e8d082f commit 5ab0c62
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Bkwld/Croppa/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,13 @@ public function cropsAreRemote() {
// Currently, the CachedAdapter doesn't have a getAdapter method so I can't
// tell if the adapter is local or not. I'm assuming that if they are using
// the CachedAdapter, they're probably using a remote disk. I've written
// a PR to add getAdapter to it. It is merged into master but not released yet.
// a PR to add getAdapter to it.
// https://github.com/thephpleague/flysystem-cached-adapter/pull/9
if (is_a($adapter, 'League\Flysystem\Cached\CachedAdapter')) return true;
if (is_a($adapter, 'League\Flysystem\Cached\CachedAdapter')) {
if (method_exists($adapter, 'getAdapter')) {
$adapter = $adapter->getAdapter(); // Get the ACTUAL adapter
} else return true;
}

// Check if the crop disk is not local
return !is_a($adapter, 'League\Flysystem\Adapter\Local');
Expand Down

0 comments on commit 5ab0c62

Please sign in to comment.