diff --git a/composer.json b/composer.json index e55b104..4ad0381 100644 --- a/composer.json +++ b/composer.json @@ -46,6 +46,7 @@ "league/flysystem-read-only": "^3.15", "league/flysystem-sftp-v3": "^3.1", "league/flysystem-webdav": "^3.29", + "league/flysystem-ziparchive": "3.x-dev", "platformcommunity/flysystem-bunnycdn": "^3.3", "symfony/dotenv": "^6.0 || ^7.0 || ^8.0", "symfony/framework-bundle": "^6.0 || ^7.0 || ^8.0", diff --git a/src/Adapter/Builder/ZipArchiveAdapterDefinitionBuilder.php b/src/Adapter/Builder/ZipArchiveAdapterDefinitionBuilder.php new file mode 100644 index 0000000..16f4889 --- /dev/null +++ b/src/Adapter/Builder/ZipArchiveAdapterDefinitionBuilder.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\FlysystemBundle\Adapter\Builder; + +use League\Flysystem\ZipArchive\ZipArchiveAdapter; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * @author Marius Posthumus + * + * @internal + */ +final class ZipArchiveAdapterDefinitionBuilder extends AbstractAdapterDefinitionBuilder +{ + public function getName(): string + { + return 'zip'; + } + + protected function getRequiredPackages(): array + { + return [ + ZipArchiveAdapter::class => 'league/flysystem-ziparchive', + ]; + } + + protected function configureOptions(OptionsResolver $resolver) + { + } + + protected function configureDefinition(Definition $definition, array $options, ?string $defaultVisibilityForDirectories): void + { + $definition->setClass(ZipArchiveAdapter::class); + } +} diff --git a/tests/Adapter/Builder/ZipArchiveAdapterDefinitionBuilderTest.php b/tests/Adapter/Builder/ZipArchiveAdapterDefinitionBuilderTest.php new file mode 100644 index 0000000..c9e5e6c --- /dev/null +++ b/tests/Adapter/Builder/ZipArchiveAdapterDefinitionBuilderTest.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Tests\League\FlysystemBundle\Adapter\Builder; + +use League\Flysystem\ZipArchive\ZipArchiveAdapter; +use League\FlysystemBundle\Adapter\Builder\ZipArchiveAdapterDefinitionBuilder; +use PHPUnit\Framework\TestCase; + +class ZipArchiveAdapterDefinitionBuilderTest extends TestCase +{ + public function createBuilder(): ZipArchiveAdapterDefinitionBuilder + { + return new ZipArchiveAdapterDefinitionBuilder(); + } + + public function testOptionsBehavior(): void + { + $this->assertSame(ZipArchiveAdapter::class, $this->createBuilder()->createDefinition([], null)->getClass()); + } +}