Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
45 changes: 45 additions & 0 deletions src/Adapter/Builder/ZipArchiveAdapterDefinitionBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

/*
* This file is part of the flysystem-bundle project.
*
* (c) Titouan Galopin <galopintitouan@gmail.com>
*
* 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 <mjtheone@gmail.com>
*
* @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);
}
}
29 changes: 29 additions & 0 deletions tests/Adapter/Builder/ZipArchiveAdapterDefinitionBuilderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
* This file is part of the flysystem-bundle project.
*
* (c) Titouan Galopin <galopintitouan@gmail.com>
*
* 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());
}
}