14
14
use League \Flysystem \Ftp \FtpAdapter ;
15
15
use League \Flysystem \Ftp \FtpConnectionOptions ;
16
16
use Symfony \Component \DependencyInjection \Definition ;
17
+ use Symfony \Component \DependencyInjection \Reference ;
17
18
use Symfony \Component \OptionsResolver \OptionsResolver ;
18
19
19
20
/**
@@ -80,6 +81,9 @@ protected function configureOptions(OptionsResolver $resolver)
80
81
81
82
$ resolver ->setDefault ('recurse_manually ' , true );
82
83
$ resolver ->setAllowedTypes ('recurse_manually ' , 'bool ' );
84
+
85
+ $ resolver ->setDefault ('connectivityChecker ' , null );
86
+ $ resolver ->setAllowedTypes ('connectivityChecker ' , ['string ' , 'null ' ]);
83
87
}
84
88
85
89
protected function configureDefinition (Definition $ definition , array $ options )
@@ -89,12 +93,19 @@ protected function configureDefinition(Definition $definition, array $options)
89
93
$ options ['timestampsOnUnixListingsEnabled ' ] = $ options ['timestamps_on_unix_listings_enabled ' ];
90
94
$ options ['ignorePassiveAddress ' ] = $ options ['ignore_passive_address ' ];
91
95
$ options ['recurseManually ' ] = $ options ['recurse_manually ' ];
96
+
97
+ $ connectivityChecker = null ;
98
+ if (null !== $ options ['connectivityChecker ' ]) {
99
+ $ connectivityChecker = new Reference ($ options ['connectivityChecker ' ]);
100
+ }
101
+
92
102
unset(
93
103
$ options ['transfer_mode ' ],
94
104
$ options ['system_type ' ],
95
105
$ options ['timestamps_on_unix_listings_enabled ' ],
96
106
$ options ['ignore_passive_address ' ],
97
- $ options ['recurse_manually ' ]
107
+ $ options ['recurse_manually ' ],
108
+ $ options ['connectivityChecker ' ]
98
109
);
99
110
100
111
$ definition ->setClass (FtpAdapter::class);
@@ -104,5 +115,7 @@ protected function configureDefinition(Definition $definition, array $options)
104
115
->addArgument ($ options )
105
116
->setShared (false )
106
117
);
118
+ $ definition ->setArgument (1 , null );
119
+ $ definition ->setArgument (2 , $ connectivityChecker );
107
120
}
108
121
}
0 commit comments