Skip to content

Commit 1563e1a

Browse files
committed
feature: addition of the ZipArchive adapter
1 parent a5fd6b6 commit 1563e1a

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"league/flysystem-read-only": "^3.15",
4747
"league/flysystem-sftp-v3": "^3.1",
4848
"league/flysystem-webdav": "^3.29",
49+
"league/flysystem-ziparchive": "3.x-dev",
4950
"platformcommunity/flysystem-bunnycdn": "^3.3",
5051
"symfony/dotenv": "^6.0 || ^7.0 || ^8.0",
5152
"symfony/framework-bundle": "^6.0 || ^7.0 || ^8.0",
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the flysystem-bundle project.
5+
*
6+
* (c) Titouan Galopin <galopintitouan@gmail.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace League\FlysystemBundle\Adapter\Builder;
13+
14+
use League\Flysystem\ZipArchive\ZipArchiveAdapter;
15+
use Symfony\Component\DependencyInjection\Definition;
16+
use Symfony\Component\OptionsResolver\OptionsResolver;
17+
18+
/**
19+
* @author Marius Posthumus <mjtheone@gmail.com>
20+
*
21+
* @internal
22+
*/
23+
final class ZipArchiveAdapterDefinitionBuilder extends AbstractAdapterDefinitionBuilder
24+
{
25+
public function getName(): string
26+
{
27+
return 'zip';
28+
}
29+
30+
protected function getRequiredPackages(): array
31+
{
32+
return [
33+
ZipArchiveAdapter::class => 'league/flysystem-ziparchive',
34+
];
35+
}
36+
37+
protected function configureOptions(OptionsResolver $resolver)
38+
{
39+
}
40+
41+
protected function configureDefinition(Definition $definition, array $options, ?string $defaultVisibilityForDirectories): void
42+
{
43+
$definition->setClass(ZipArchiveAdapter::class);
44+
}
45+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the flysystem-bundle project.
5+
*
6+
* (c) Titouan Galopin <galopintitouan@gmail.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Tests\League\FlysystemBundle\Adapter\Builder;
13+
14+
use League\Flysystem\ZipArchive\ZipArchiveAdapter;
15+
use League\FlysystemBundle\Adapter\Builder\ZipArchiveAdapterDefinitionBuilder;
16+
use PHPUnit\Framework\TestCase;
17+
18+
class ZipArchiveAdapterDefinitionBuilderTest extends TestCase
19+
{
20+
public function createBuilder(): ZipArchiveAdapterDefinitionBuilder
21+
{
22+
return new ZipArchiveAdapterDefinitionBuilder();
23+
}
24+
25+
public function testOptionsBehavior(): void
26+
{
27+
$this->assertSame(ZipArchiveAdapter::class, $this->createBuilder()->createDefinition([], null)->getClass());
28+
}
29+
}

0 commit comments

Comments
 (0)