1414use League \Flysystem \Ftp \FtpAdapter ;
1515use League \Flysystem \Ftp \FtpConnectionOptions ;
1616use Symfony \Component \DependencyInjection \Definition ;
17+ use Symfony \Component \DependencyInjection \Reference ;
1718use Symfony \Component \OptionsResolver \OptionsResolver ;
1819
1920/**
@@ -80,6 +81,9 @@ protected function configureOptions(OptionsResolver $resolver)
8081
8182 $ resolver ->setDefault ('recurse_manually ' , true );
8283 $ resolver ->setAllowedTypes ('recurse_manually ' , 'bool ' );
84+
85+ $ resolver ->setDefault ('connectivityChecker ' , null );
86+ $ resolver ->setAllowedTypes ('connectivityChecker ' , ['string ' , 'null ' ]);
8387 }
8488
8589 protected function configureDefinition (Definition $ definition , array $ options )
@@ -89,12 +93,19 @@ protected function configureDefinition(Definition $definition, array $options)
8993 $ options ['timestampsOnUnixListingsEnabled ' ] = $ options ['timestamps_on_unix_listings_enabled ' ];
9094 $ options ['ignorePassiveAddress ' ] = $ options ['ignore_passive_address ' ];
9195 $ options ['recurseManually ' ] = $ options ['recurse_manually ' ];
96+
97+ $ connectivityChecker = null ;
98+ if (null !== $ options ['connectivityChecker ' ]) {
99+ $ connectivityChecker = new Reference ($ options ['connectivityChecker ' ]);
100+ }
101+
92102 unset(
93103 $ options ['transfer_mode ' ],
94104 $ options ['system_type ' ],
95105 $ options ['timestamps_on_unix_listings_enabled ' ],
96106 $ options ['ignore_passive_address ' ],
97- $ options ['recurse_manually ' ]
107+ $ options ['recurse_manually ' ],
108+ $ options ['connectivityChecker ' ]
98109 );
99110
100111 $ definition ->setClass (FtpAdapter::class);
@@ -104,5 +115,7 @@ protected function configureDefinition(Definition $definition, array $options)
104115 ->addArgument ($ options )
105116 ->setShared (false )
106117 );
118+ $ definition ->setArgument (1 , null );
119+ $ definition ->setArgument (2 , $ connectivityChecker );
107120 }
108121}
0 commit comments