Skip to content

Commit 9c3f823

Browse files
authored
Merge pull request thephpleague#88 from matchory/feature/add-missing-options
Added missing options to FTP adapter
2 parents 10b726c + b07d18b commit 9c3f823

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

src/Adapter/Builder/FtpAdapterDefinitionBuilder.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,36 @@ protected function configureOptions(OptionsResolver $resolver)
6666

6767
$resolver->setDefault('utf8', false);
6868
$resolver->setAllowedTypes('utf8', 'scalar');
69+
70+
$resolver->setDefault('transfer_mode', null);
71+
$resolver->setAllowedTypes('transfer_mode', ['null', 'scalar']);
72+
$resolver->setAllowedValues('transfer_mode', [null, FTP_ASCII, FTP_BINARY]);
73+
74+
$resolver->setDefault('system_type', null);
75+
$resolver->setAllowedTypes('system_type', ['null', 'string']);
76+
$resolver->setAllowedValues('system_type', [null, 'windows', 'unix']);
77+
78+
$resolver->setDefault('timestamps_on_unix_listings_enabled', false);
79+
$resolver->setAllowedTypes('timestamps_on_unix_listings_enabled', 'bool');
80+
81+
$resolver->setDefault('recurse_manually', true);
82+
$resolver->setAllowedTypes('recurse_manually', 'bool');
6983
}
7084

7185
protected function configureDefinition(Definition $definition, array $options)
7286
{
87+
$options['transferMode'] = $options['transfer_mode'];
88+
$options['systemType'] = $options['system_type'];
89+
$options['timestampsOnUnixListingsEnabled'] = $options['timestamps_on_unix_listings_enabled'];
7390
$options['ignorePassiveAddress'] = $options['ignore_passive_address'];
74-
unset($options['ignore_passive_address']);
91+
$options['recurseManually'] = $options['recurse_manually'];
92+
unset(
93+
$options['transfer_mode'],
94+
$options['system_type'],
95+
$options['timestamps_on_unix_listings_enabled'],
96+
$options['ignore_passive_address'],
97+
$options['recurse_manually']
98+
);
7599

76100
$definition->setClass(FtpAdapter::class);
77101
$definition->setArgument(0,

tests/Adapter/Builder/FtpAdapterDefinitionBuilderTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ public function testOptionsBehavior()
7777
'host' => 'ftp.example.com',
7878
'username' => 'username',
7979
'password' => 'password',
80+
'transferMode' => null,
81+
'systemType' => null,
82+
'timestampsOnUnixListingsEnabled' => false,
8083
'ignorePassiveAddress' => true,
84+
'recurseManually' => true,
8185
];
8286

8387
$this->assertSame(FtpAdapter::class, $definition->getClass());

0 commit comments

Comments
 (0)